📄 IrbyImaging/Views/JDE/Details.cshtml Documentation
📑 Table of Contents
- Overview & Purpose
- Technology Stack & Dependencies
- View Model & Data Model
- Key Functional Areas
4.1. Field Office Details Form
4.2. Data Grids
- Total Jobs Grid
- Work Order List Grid
- Total Employees Grid
- Equipment List Grid
- IT Assets Assigned Grid
- Purchase Order List Grid - JavaScript Interactivity & Helper Methods
- Templates & Custom Cell Rendering
- Sample Controller Usage
- Mermaid UML Diagram
- Usage Examples
- Conclusion
🔍 Overview & Purpose
Details.cshtml is an ASP.NET Core Razor View under IrbyImaging/Views/JDE. It displays Field Office details in a read-only form and renders multiple Syncfusion EJ2 tree grids to show related data:
- Field Office metadata
- Total Jobs
- Work Orders
- Employees
- Equipment
- IT Assets
- Purchase Orders
This view is intended for users (e.g., administrators, project managers) to get a holistic, interactive snapshot of a specific Field Office and its related entities without leaving the page.
🛠 Technology Stack & Dependencies
| Category | Libraries / Frameworks |
|---|---|
| Front‑End Framework | Bootstrap 4, Syncfusion EJ2 Grids |
| JavaScript & Plugins | jQuery, Select2, Bootstrap-datepicker, Dropzone CSS (unused), TinyMCE JS (loaded), Spin.js |
| Styles | Bootstrap CSS, Dropzone CSS |
| Server-side | ASP.NET Core MVC, Razor Views |
| Data Binding | Razor Tag Helpers (asp-for, asp-items, asp-action) |
🧩 View Model & Data Model
@model IrbyImaging.DomainClasses.FieldOffice
DomainClasses.FieldOffice (relevant properties)
| Property | Type | Description |
|---|---|---|
int Id |
int |
Primary key |
string JdeNumber |
string |
JDE identifier |
string Name |
string |
Field Office name |
int? ManagerId |
int? |
FK to Employee who is Manager |
int? SuperintendentId |
int? |
FK to Superintendent |
int? LeadId |
int? |
FK to Lead |
int? DirectorId |
int? |
FK to Director |
int? ProjectManagerId |
int? |
FK to Project Manager |
int? AsstProjectManagerId |
int? |
FK to Asst. Project Manager |
string OfficePhone |
string |
Phone number |
string FaxNumber |
string |
Fax number |
string MailingAddress |
string |
Mailing address |
string ShippingAddress |
string |
Shipping address |
int? PrimaryContactId |
int? |
FK to Primary Contact |
string PrimaryContactPhone |
string |
Primary Contact phone |
int? SecondaryContactId |
int? |
FK to Secondary Contact |
string SecondaryContactPhone |
string |
Secondary Contact phone |
SelectList EmployeeData |
SelectList |
Used to populate <select> lists |
ViewBag Data
| Key | Type | Purpose |
|---|---|---|
ViewBag.Jobs |
IEnumerable<JobView> |
DataSource for Total Jobs grid |
ViewBag.WorkOrder |
IEnumerable<WorkOrderView> |
DataSource for Work Orders grid |
ViewBag.Employees |
IEnumerable<EmployeeView> |
DataSource for Total Employees grid |
ViewBag.Equipment |
IEnumerable<EquipmentView> |
DataSource for Equipment grid |
ViewBag.Assets |
IEnumerable<AssetView> |
DataSource for IT Assets grid |
ViewBag.PurchaseOrder |
IEnumerable<PurchaseOrderView> |
DataSource for Purchase Orders grid |
🔑 Key Functional Areas
4.1. Field Office Details Form
<form asp-action="Edit">
<input type="hidden" asp-for="Id" />
<div class="form-group row mb-4">
<label class="col-form-label col-sm-1"><strong>JDE Number</strong></label>
<div class="col-lg-2">
<input asp-for="JdeNumber" class="form-control" readonly/>
</div>
<label class="col-form-label col-sm-1"><strong>Field Office Name</strong></label>
<div class="col-lg-2">
<input asp-for="Name" class="form-control" readonly/>
</div>
</div>
<!-- Additional rows for Manager, Superintendent, Lead, Director, Phones, Addresses, etc. -->
</form>
- Read‑only inputs display core
FieldOfficeproperties. - Select lists (
<select asp-for="ManagerId" asp-items="Model.EmployeeData" disabled>) show related employees. - A Back button links to
asp-action="Index".
4.2. Data Grids
All grids use Syncfusion EJ2 with features:
- Tree‑structure via
childMapping="Children" - Filtering, sorting, paging, column menu, excel/pdf export
- Search input +
<ejs-button>triggersgrid.search(value)
Total Jobs Grid
<ejs-grid id="grid3"
load="load"
dataSource="ViewBag.Jobs"
childMapping="Children"
treeColumnIndex="0"
allowFiltering="true" allowSorting="true"
allowPaging="true"
toolbar="@(new List<string>{ "ExcelExport","PdfExport" })"
dataBound="dataBound3">
<e-grid-pagesettings pageSize="10"></e-grid-pagesettings>
<e-grid-columns>
<e-grid-column field="JdeNumber" headerText="Job#" width="150"></e-grid-column>
<e-grid-column field="Name" headerText="Name" width="220"></e-grid-column>
<!-- more columns -->
</e-grid-columns>
</ejs-grid>
- Date formatting:
loadevent formats date columns (MM/dd/yyyy). - Auto-fit columns on
dataBound3. - Search:
document.getElementById('Search3').addEventListener('click', () => { let val = document.getElementById('searchText3').value; let grid = document.getElementById('grid3').ej2_instances[0]; grid.search(val); });
Work Order List Grid
- ID:
grid6,load6,dataBound6 - Columns include
WorkOrderNumber, nested fieldJob.JdeNumber, templates
Total Employees Grid
- ID:
grid2,dataBound2 - Custom template for JDE number linking to Employee Details
Equipment List Grid
- ID:
grid4,load4,dataBound4 - Columns:
AssetNumber,UnitTagNumber, nestedJob.Name
IT Assets Assigned Grid
- ID:
grid(default),dataBound - Columns:
Category,Make,Model,OwnerFullNamewith template
Purchase Order List Grid
- ID:
grid5,load5,dataBound5 - Columns:
OrderNumber,OrderDate, vendor details
⚙️ JavaScript Interactivity & Helper Methods
| Function Name | Purpose |
|---|---|
dataBoundX() |
Auto‑fit column widths after data is bound |
loadX() |
Format date columns on grid initialization |
toolbarClick(args) |
Handle Excel/PDF/CSV export with collapsed-state option |
onChange(args) |
Toggle collapsedStatePersist for export |
search listeners |
Bind <input> + <ejs-button> to invoke grid.search() |
// Example: Excel/PDF export handler
function toolbarClick(args) {
let gridObj = this; // or target grid
if (args.item.id.endsWith('_excelexport')) {
gridObj.excelExport({ isCollapsedStatePersist: collapsedStatePersist });
} else if (args.item.id.endsWith('_pdfexport')) {
gridObj.pdfExport({ isCollapsedStatePersist: collapsedStatePersist });
} else if (args.item.id.endsWith('_csvexport')) {
gridObj.csvExport();
}
}
🎨 Templates & Custom Cell Rendering
Employee Name Template
<script id="emptemplate" type="text/x-template">
<div>
<a target="_blank" href="/Employees/Details/${EmployeeId}">
${OwnerFullName}
</a>
</div>
</script>
Job Link Template
<script id="jobtemplate" type="text/x-template">
<div>
<a target="_blank" href="/Jobs/Details/${JobId}">
${JobName}
</a>
</div>
</script>
Similar templates are defined for Equipment (jobtemplate4), Work Orders (jobtemplate6), Purchase Orders (jobtemplate5), and Field Office breadcrumb (fldtemplate).
🧑💻 Sample Controller Usage
public class JDEController : Controller
{
private readonly ApplicationDbContext _context;
public JDEController(ApplicationDbContext context) => _context = context;
public async Task<IActionResult> Details(int id)
{
var fieldOffice = await _context.FieldOffices
.Include(f => f.Employees) // for EmployeeData
.SingleOrDefaultAsync(f => f.Id == id);
if (fieldOffice == null)
return NotFound();
// Populate ViewBag collections
ViewBag.Jobs = await _jobService.GetJobsByFieldOffice(id);
ViewBag.WorkOrder = await _woService.GetWorkOrders(id);
ViewBag.Employees = await _empService.GetEmployeesByOffice(id);
ViewBag.Equipment = await _equipService.GetEquipment(id);
ViewBag.Assets = await _assetService.GetAssets(id);
ViewBag.PurchaseOrder = await _poService.GetPurchaseOrders(id);
// Employee select list for form
fieldOffice.EmployeeData = new SelectList(
await _empService.AllEmployeesAsync(),
"Value","Text",
fieldOffice.ManagerId);
return View(fieldOffice);
}
}
📊 Mermaid UML Diagram
classDiagram
class DetailsView {
+FieldOffice Model
+ViewBag.Jobs,WorkOrder,Employees,Equipment,Assets,PurchaseOrder
}
class FieldOffice {
+int Id
+string JdeNumber
+string Name
+...other props
}
class SyncfusionGrid {
+search(val)
+excelExport(props)
+pdfExport(props)
+csvExport()
}
DetailsView --> FieldOffice
DetailsView --> SyncfusionGrid : renders 6 grids
🔧 Usage Examples
-
Searching in Grids
- Type “ACME” in the Total Jobs search box
- Click Search → grid3 filters rows containing “ACME”.
-
Exporting Data
- In any grid toolbar, click ExcelExport or PdfExport
- The current tree‑state (collapsed/expanded) is preserved in the export.
-
Navigating to Details
- Click any Job# or Employee Name link within the grids
- Opens the relevant Details view in a new tab (
target="_blank").
🏁 Conclusion
This Details.cshtml view offers a comprehensive, single‐page dashboard for a Field Office. It leverages ASP.NET Core MVC Razor syntax, Syncfusion EJ2 tree grids for hierarchical data, and various JavaScript utilities (search, export, templating). The read‑only form combined with interactive grids provides users with:
- 📋 A snapshot of core Field Office data
- 📊 Rich, filterable/exportable grids for related entities
- 🔗 Quick navigation links to detail pages
- 🛠️ Extensible structure to add additional tabs or custom JS
Overall, this modular design ensures maintainability and a streamlined user experience.
Happy Browsing! 😊