📋 Accounting Imaging – List.cshtml Documentation


Table of Contents

  1. Overview & Purpose
  2. Dependencies & Technologies
  3. View Model & Data Structures
  4. Layout & Initialization
  5. Styles & CSS Sections
  6. Key Functional Areas
    6.1 🔍 Search Section
    6.2 📝 To‑Do List Widget
    6.3 ⏰ Expiring Soon Panel
    6.4 📈 Document Stats
    6.5 📊 Charts Section (Legal)
    6.6 🗂️ Recent Documents (Legal)
  7. Helper Methods & Utilities
  8. Client‑Side Scripts
    8.1 DataTables Initialization
    8.2 To‑Do List JavaScript
  9. Third‑Party Integrations
  10. UML Class Diagram
  11. Usage Examples
  12. Conclusion

Overview & Purpose

List.cshtml is the primary Razor View for the Accounting Imaging Dashboard in the IrbyImaging application. It serves to:

  • Provide a unified search interface for all document categories (accounting, legal, safety, IT, bidding).
  • Display to‑do items, documents expiring soon, and aggregate statistics.
  • (For legal category) render interactive charts and a “Recent Documents” DataTable.

🛠 The view posts user inputs to an AccountingImagingController.SearchAll action, receives back search results in the DocumentImaging model + various ViewBag payloads, and dynamically renders the UI.


Dependencies & Technologies

Technology / Library Purpose
ASP.NET Core MVC / Razor Server-side view rendering
Syncfusion EJ2 (ejs-*) Rich UI controls (Textbox, Multiselect, Charts)
jQuery DOM manipulation & AJAX
DataTables (+ Buttons) Tabular data with export/print features
Bootstrap (4/5) Layout & responsive styling
ApexCharts / Google Charts Charting (commented-out or legacy)
Moment / DatePicker Date-range selection
Newtonsoft.Json Serializing job data for client-side filtering
CultureInfo Date parsing for “Expiring Soon” logic

View Model & Data Structures

DocumentImaging (Model)

public class DocumentImaging {
  public Guid DocumentImageId { get; set; }
  public string DocumentType { get; set; }
  public string FilePath { get; set; }
  public bool OcrSearch { get; set; }
  public List<Guid> BatchIds { get; set; }
  public int ReferenceId { get; set; }
  public string IndexTag { get; set; }
  public string ContentType { get; set; }

  // Lookup Data for filters
  public IEnumerable<SelectListItem> DocumentCategories { get; set; }
  public IEnumerable<SelectListItem> DocumentTypes { get; set; }
  public IEnumerable<SelectListItem> EmployeeData { get; set; }
  public IEnumerable<SelectListItem> JobData { get; set; }

  // Search Results / Panels
  public IEnumerable<DocumentImaging> ImagingList { get; set; }
  public IEnumerable<LeaseResult> LeaseResults { get; set; }
  public IEnumerable<DocumentImaging> RecentDocuments { get; set; }

  // Flags
  public bool IsLegalDocument { get; set; }
  public bool IsSafety { get; set; }
  public bool IsIT { get; set; }
  public bool IsAccounting { get; set; }
  public bool IsBidding { get; set; }
}

Layout & Initialization

@model IrbyImaging.Models.DocumentImaging
@using Syncfusion.JavaScript
@using Syncfusion.JavaScript.Models
@using Newtonsoft.Json
@{
    ViewData["Title"] = "Dashboard";
    Layout = "~/Views/Shared/_AccountingLayout.cshtml";

    // Determine Document Category
    var category = ViewBag.category 
                   ?? (Model.IsLegalDocument ? "legal"
                   : Model.IsSafety      ? "safety"
                   : Model.IsIT          ? "it"
                   : Model.IsAccounting  ? "accounting"
                   : Model.IsBidding     ? "bidding"
                                        : "accounting");
}
  1. Model Declaration: strongly‑typed to DocumentImaging.
  2. Layout & Title: uses a shared _AccountingLayout.
  3. Category Logic: chooses UI mode based on flags or ViewBag.category.

Styles & CSS Sections

Within @section styles{…} the view references:

  • Bootstrap DatePicker
  • DataTables (BS4/BS5 & Buttons CSS)
  • Responsive DataTables

Custom styles later in the file define scrollbars, card borders, layout flex containers, color‑coding for expiration, and Syncfusion panel theming.


Key Functional Areas

1. Search Section

<form asp-action="SearchAll" method="post" target="_blank" class="form-horizontal typeSearch">
  @* Hidden fields *@
  @Html.HiddenFor(m => m.DocumentImageId)
  @Html.HiddenFor(m => m.BatchIds, new { Value = string.Join(",", Model.BatchIds ?? new List<Guid>()) })
  @Html.AntiForgeryToken()

  <div id="searchSection" class="row">
    <div class="col-lg-16 topHeader">
      <div class="card cardBorder">
        <div class="card-body">
          <h4 class="card-title searchHeader">Search all Documents</h4>
          <button type="submit" class="btn btn-primary btn-sm searchButton">Search</button>

          <div data-repeater-list="outer-group" class="outer">
            <div data-repeater-item class="outer">
              <div class="form-group row searchOptions">
                
                <!-- Free text search -->
                <ejs-textbox id="searchString" placeholder="Search Anything"></ejs-textbox>
                
                <!-- Category Multiselect -->
                <ejs-multiselect id="categoryList"
                                  dataSource="@Model.DocumentCategories"
                                  mode="CheckBox" placeholder="Document Category">
                  <e-multiselect-fields text="Text" value="Value"/>
                </ejs-multiselect>

                <!-- Type Multiselect -->
                <ejs-multiselect id="typeList"
                                  dataSource="@Model.DocumentTypes"
                                  mode="CheckBox" placeholder="Select Document Type"
                                  enableGroupCheckBox="true">
                  <e-multiselect-fields groupBy="Group.Name" text="Text" value="Value"/>
                </ejs-multiselect>
                
                <!-- Date Range Picker -->
                <ejs-daterangepicker id="daterangepicker" placeholder="Choose a Date Range"></ejs-daterangepicker>
                
                <!-- Job Dropdown (filtered via JS) -->
                <ejs-dropdownlist allowFiltering="true"
                                   id="jobNameSearch"
                                   dataSource="@Model.JobData"
                                   filterBarPlaceholder="Select a Job">
                  <e-dropdownlist-fields text="Text" value="Text"/>
                </ejs-dropdownlist>
                
                <!-- OCR Search Checkbox -->
                @Html.CheckBoxFor(m => m.OcrSearch)
                @Html.Label("OCR Search (Will take much longer)")
                
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
</form>
  • Flexbox layout for responsive alignment.
  • Syncfusion EJ2 controls for advanced UX.
  • Repeater (data-repeater-list) allows dynamic filter rows (if needed).

2. To‑Do List Widget

📋 Users can add temporary tasks that live only on the client.

<div class="card cardBorder">
  <div class="card-body">
    <h4 class="card-title">To-Do List</h4>
    <input type="text" id="todo" name="to-do" class="form__input"/>
    <button id="addTodo" class="btn btn-primary btn-sm">Add</button>
    <ul class="toDoList"></ul>
    <button id="RemoveCompleted" class="btn btn-primary btn-sm">Remove Completed</button>
  </div>
</div>
  • JS Logic toggles toDoItemCompleted, stores tasks in an in‑memory array (toDoListArray).
  • No server persistence (all client-side).

3. Expiring Soon Panel

🔔 Displays documents whose first index value parses to a date within the next 90 days.

<ul class="expiringList">
  @foreach (var img in Model.ImagingList) {
    if (DateTime.TryParseExact(
          img.IndexList[0].IndexValue,
          new[] { "dd/MM/yyyy", "yyyy-MM-dd" },
          CultureInfo.InvariantCulture,
          DateTimeStyles.None,
          out DateTime parseDate))
    {
      var daysToExpire = (parseDate - DateTime.Today).Days;
      if (daysToExpire <= 90 && daysToExpire >= 0) {
        <li class="expiringItem">
          @Path.GetFileNameWithoutExtension(img.FileName) expires in @daysToExpire days.
          [ @Html.ActionLink("View", "ViewDoc", "LegalImaging", new { id = img.DocumentImageId }, new {target="_blank"}) ]
          [ @Html.ActionLink("Edit", "Edit", "LegalImaging", new { id = img.DocumentImageId }, new {target="_blank"}) ]
        </li>
      }
    }
  }
</ul>
  • Date parsing uses multiple formats.
  • Conditional styling via CSS classes (expired, expiresSoon, expireWarning).

4. Document Stats

A summary card showing counts retrieved from ViewBag:

Metric Source
All Documents ViewBag.DocCount
Contract Count ViewBag.ContractCount
License Count ViewBag.LicenseCount
Lease Count ViewBag.LeaseCount
Certificate of Insurance Count ViewBag.CoICount
<div class="card statsBorder">
  <h4 class="card-title">Document Stats</h4>
  <p>All Documents: @ViewBag.DocCount</p>
  <p>Contract Count: @ViewBag.ContractCount</p>
  <!-- … -->
</div>

(Rendered only if category == "legal")

<ejs-chart id="splineContainer" title="Lease Location Overview">
  <e-series-collection>
    <e-series dataSource="ViewBag.DirectorDetails"
              xName="Director" yName="Texas"
              type="StackingBar100" name="Texas">…</e-series>
    <!-- Additional series for Florida, Oklahoma, … -->
  </e-series-collection>
  <e-chart-legendsettings visible="true"></e-chart-legendsettings>
</ejs-chart>
  • Stacking 100% Bar Charts break out lease distribution by state and director.
  • Tooltips & Legends enabled.

A second chart (contractsContainer) shows Contracts By State with similar stacking.

A scrollable DataTable of the last N uploaded legal documents:

<table id="recentTable" class="table table-striped">
  <thead>
    <tr>
      <th>Document Type</th>
      <th>Document Name</th>
      <th>Date Uploaded</th>
      <th>Uploaded By</th>
      <th>View</th>
    </tr>
  </thead>
  <tbody>
    @foreach (var doc in Model.RecentDocuments) {
      <tr>
        <td>@doc.DocumentType</td>
        <td>@Path.GetFileNameWithoutExtension(doc.FileName)</td>
        <td>@doc.DocumentUploadedDate</td>
        <td>@doc.DocumentUploadedBy</td>
        <td>@Html.ActionLink("View", "ViewDoc", "LegalImaging", new { id=doc.DocumentImageId}, new { target="_blank" })</td>
      </tr>
    }
  </tbody>
</table>
  • Fixed height + scrollY → vertical scrollbar.
  • Automatic ordering newest first by upload date.

Helper Methods & Utilities

// Syncfusion – Filters job dropdown as user types
function jobFilter(e) {
  var query = new ej.data.Query();
  query = e.text !== ''
    ? query.where('Text', 'contains', e.text, true)
    : query;
  e.updateData(@Html.Raw(JsonConvert.SerializeObject(Model.JobData)), query);
}
  • jobFilter binds to the EJ2 filtering event, performing client‑side search on JobData.

Client‑Side Scripts

1. DataTables Initialization

$(document).ready(function() {
  $('#recentTable').DataTable({
    paging: false,
    scrollY: '400px',
    order: [[2, 'desc']],
    buttons: ['csv','excel','print']
  });

  // Highlight expiring rows
  function colorizeRows(tableSelector) {
    $(tableSelector).find('tbody tr').each(function() {
      var text = $(this).find('.indexSearch').text() || '';
      if (text.includes('Expiration Date')) {
        var dateStr = text.split(') ')[1];
        var days = Math.floor((new Date(dateStr) - new Date())/86400000);
        $(this).addClass(days <= 0   ? 'expired'
                         : days <= 30  ? 'expiresSoon'
                         : days <= 90  ? 'expireWarning'
                                       : '' );
      }
    });
  }
  colorizeRows('#datatable-buttons');
  colorizeRows('#datatable-buttons2');
});

2. To‑Do List JavaScript

(() => {
  let toDoListArray = [], completedArray = [];
  const ul = document.querySelector(".toDoList");

  // Add Item
  $('#addTodo').click(e => {
    e.preventDefault();
    let id = Date.now().toString(),
        text = $('#todo').val();
    toDoListArray.push({ id, text });
    ul.appendChild(
      Object.assign(document.createElement('li'), {
        innerText: `${text} – @ViewBag.User`,
        dataset: { id }
      })
    );
    $('#todo').val('');
  });

  // Strike/Complete
  ul.addEventListener('click', ev => {
    if (ev.target.dataset.id) ev.target.classList.toggle('toDoItemCompleted');
  });

  // Remove Completed
  $('#RemoveCompleted').click(() => {
    $('.toDoItemCompleted').each((_, li) => {
      let id = li.dataset.id;
      toDoListArray = toDoListArray.filter(x => x.id !== id);
      li.remove();
    });
  });
})();

Third‑Party Integrations

  • Syncfusion EJ2 – advanced UI widgets & charts
  • DataTables.net – tabular display with export buttons
  • Bootstrap – responsive grid & components
  • JSON.NET – model serialization for JS
  • ApexCharts / Google Charts – alternative charting (legacy/commented)

UML Class Diagram

classDiagram
  class DocumentImaging {
    +Guid DocumentImageId
    +string DocumentType
    +string FilePath
    +bool OcrSearch
    +List~Guid~ BatchIds
    +IEnumerable~SelectListItem~ DocumentCategories
    +IEnumerable~SelectListItem~ DocumentTypes
    +IEnumerable~SelectListItem~ EmployeeData
    +IEnumerable~SelectListItem~ JobData
    +IEnumerable~DocumentImaging~ ImagingList
    +IEnumerable~DocumentImaging~ RecentDocuments
    +bool IsLegalDocument
    +bool IsSafety
    +bool IsIT
    +bool IsAccounting
    +bool IsBidding
  }

Usage Examples

  1. Navigate to /AccountingImaging/List
  2. Select filters (category, type, date range, job) and click Search
  3. Results will open in a new window/tab (target="_blank").
  4. Monitor expiring documents and add personal To‑Do reminders.
  5. (Legal Category only) View interactive charts and Recent Documents.

Conclusion

The List.cshtml view orchestrates a rich, client‑driven dashboard to search, track, and visualize document imaging workflows for accounting (and other) categories. Leveraging Syncfusion, DataTables, and custom JS, it transforms raw index data into actionable insights—complete with charts, to‑do items, and expiration alerts.

Happy documenting! 🚀