๐ Field Office Details View Documentation
Welcome to the comprehensive documentation for the IrbyImaging/Views/FieldOffices/Details.cshtml Razor view. This page displays details of a field office and related data (jobs, employees, assets) in interactive TreeGrids.
๐ Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- Data Model & ViewModel
- Page Layout & Razor Directives
- Styles Section
- Field Office Details Form
6.1. JDE Number & Name
6.2. Roles (Manager, Superintendent, Lead, etc.)
6.3. Contact Information
6.4. Addresses
6.5. Primary & Secondary Contacts - Data Grids (Syncfusion EJ2 TreeGrid)
7.1. Total Jobs ๐จ
7.2. Total Employees ๐ฅ
7.3. Total IT Assets ๐ป - JavaScript Functionality & Helpers
8.1. Search Filters ๐
8.2. Export Toolbar & Persistence
8.3. Date Column Formatting
8.4. Select2 Initialization - Helper Templates
- UML Component Diagram
- Conclusion
1. Overview & Purpose
This view renders a read-only details page for a single Field Office. It includes:
- A form summarizing the field officeโs key properties (JDE, Name, Roles, Contacts, Addresses).
- Interactive, exportable data tables (TreeGrids) for:
- Associated Jobs
- Assigned Employees
- Allocated IT Assets
๐ฏ Intended Use:
Site administrators or operations personnel review field office details and drill into related data.
2. Dependencies & Technologies
| Library / Plugin | Purpose |
|---|---|
| ASP.NET Core Razor Pages | Server-side view rendering & tag helpers |
| Syncfusion EJ2 TreeGrid | Interactive hierarchical data grids |
| Bootstrap | Layout & form styling |
| jQuery | DOM manipulation |
| Select2 | Enhanced <select> dropdowns |
| Bootstrap Datepicker | Date selection UI (css imported but not used here) |
| Dropzone | File uploads (css imported but not used here) |
| TinyMCE | Rich text editor (loaded but not used here) |
Note: Some scripts/styles (e.g., datepicker, dropzone, TinyMCE) are included globally but not directly utilized in this page.
3. Data Model & ViewModel
@model IrbyImaging.DomainClasses.FieldOffice
- FieldOffice domain class:
- Id, JdeNumber, Name
- ManagerId, SuperintendentId, LeadId, DirectorId
- ProjectManagerId, AsstProjectManagerId
- OfficePhone, FaxNumber
- MailingAddress, ShippingAddress
- PrimaryContactId, PrimaryContactPhone, SecondaryContactId, SecondaryContactPhone
EmployeeData(IEnumerable) for populating dropdowns
Additionally, the view uses ViewBag to pass collections for TreeGrids:
ViewBag.JobsViewBag.EmployeesViewBag.Assets
4. Page Layout & Razor Directives
@model IrbyImaging.DomainClasses.FieldOffice
@{
ViewData["Title"] = "Field Office Details";
Layout = "~/Views/Shared/_ATSLayout.cshtml";
}
@section styles { /* external CSS references */ }
...
@section Scripts { await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
- ViewData["Title"]: Sets the browser tab and page header.
- Layout: Inherits a shared layout (
_ATSLayout.cshtml). - Sections:
stylesfor page-specific CSSScriptsfor clientโside validation
5. Styles Section
@section styles{
<link href="~/libs/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet">
<link href="~/libs/dropzone/min/dropzone.min.css" rel="stylesheet" type="text/css" />
}
- Includes styles for datepicker & dropzone (bundled globally).
6. Field Office Details Form
A <form asp-action="Edit"> displays key properties in read-only fields.
6.1. JDE Number & Name
<label><strong>JDE Number</strong></label>
<input asp-for="JdeNumber" class="form-control" readonly/>
<label><strong>Field Office Name</strong></label>
<input asp-for="Name" class="form-control" readonly />
- asp-for binds to model properties.
- readonly attribute prevents editing.
6.2. Roles (Manager, Superintendent, Lead, etc.)
<select asp-for="ManagerId" asp-items="@Model.EmployeeData" disabled="true" class="js-example-basic-single"></select>
| Role | Property |
|---|---|
| Manager | ManagerId |
| Superintendent | SuperintendentId |
| Lead | LeadId |
| Director | DirectorId |
| Project Manager | ProjectManagerId |
| Asst Project Manager | AsstProjectManagerId |
- Select2 class (
js-example-basic-single) for consistent styling.
6.3. Contact Information
<input asp-for="OfficePhone" readonly class="form-control"/>
<input asp-for="FaxNumber" readonly class="form-control"/>
6.4. Addresses
<input asp-for="MailingAddress" readonly class="form-control"/>
<input asp-for="ShippingAddress" readonly class="form-control"/>
6.5. Primary & Secondary Contacts
<select asp-for="PrimaryContactId" asp-items="@Model.EmployeeData" disabled class="js-example-basic-single"></select>
<input asp-for="PrimaryContactPhone" readonly/>
<select asp-for="SecondaryContactId" asp-items="@Model.EmployeeData" disabled class="js-example-basic-single"></select>
<input asp-for="SecondaryContactPhone" readonly/>
7. Data Grids (Syncfusion EJ2 TreeGrid)
Three collapsible, exportable TreeGrids present hierarchical data.
7.1. Total Jobs ๐จ
id="TreeGrid3"&dataSource="ViewBag.Jobs"- Toolbar: Excel, CSV, PDF, Print
- Features: Filtering, Sorting, Paging, Excel/PDF Export
- Columns: JdeNumber, Name, JobType, ContractType, WorkType, Customer, Manager, Superintendent, ProjectEstimator, JobStatus, DateActualStart, DateActualComplete, DatePlannedStart, DatePlannedComplete, RevenueDerivative, GeoRegionCode
<ejs-treegrid id="TreeGrid3"
dataSource="ViewBag.Jobs"
childMapping="Children"
treeColumnIndex="0"
allowFiltering="true" allowSorting="true" allowPaging="true"
allowExcelExport="true" allowPdfExport="true"
toolbar="@(new List<string>() { "ExcelExport","CsvExport","PdfExport","Print"})">
<!-- Columns defined here -->
</ejs-treegrid>
7.2. Total Employees ๐ฅ
id="TreeGrid2"&dataSource="ViewBag.Employees"- Columns: JdeNumber (with template link), LastName, FirstName, MiddleName, Current Job (template link), EmployeeStatus
7.3. Total IT Assets ๐ป
id="TreeGrid"&dataSource="ViewBag.Assets"- Columns: Category, Make, Model, SerialNumber, EmployeeName (template link), Status
8. JavaScript Functionality & Helpers
8.1. Search Filters ๐
Each grid has a search textbox + button:
document.getElementById('Search3').addEventListener('click', function() {
var val = document.getElementById('searchText3').value;
var treegrid = document.getElementById('TreeGrid3').ej2_instances[0];
treegrid.search(val);
});
treegrid.search(val)filters rows based on input.
8.2. Export Toolbar & Persistence
function toolbarClick(args) {
var grid = document.getElementById("TreeGrid3").ej2_instances[0];
if (args.item.id.endsWith('_excelexport')) {
grid.excelExport({ isCollapsedStatePersist: collapsedStatePersist });
} else if (args.item.id.endsWith('_pdfexport')) {
grid.pdfExport({ isCollapsedStatePersist: collapsedStatePersist });
} else if (args.item.id.endsWith('_csvexport')) {
grid.csvExport();
}
}
collapsedStatePersisttoggles whether collapsed rows remain collapsed after export.
8.3. Date Column Formatting
function load(args) {
this.columns[10].format = { type: 'date', format: 'MM/dd/yyyy' };
this.columns[11].format = { type: 'date', format: 'MM/dd/yyyy' };
// etc.
}
- Sets date formatting on specific columns when the grid loads.
8.4. Select2 Initialization
$(document).ready(function () {
$('.js-example-basic-single').select2();
});
- Enhances all
<select>elements with classjs-example-basic-single.
9. Helper Templates
| Template ID | Purpose |
|---|---|
#emptemplate |
Employee link in Assets grid |
#emptemplate1 |
JDE link in Employees grid |
#jobtemplate |
Job link in Employees grid |
#fldtemplate |
Field Office link in Jobs grid |
<script id="jobtemplate" type="text/x-template">
<a target="_blank" href="/Jobs/Details/${JobId}">${JobName}</a>
</script>
10. UML Component Diagram
graph LR
A[Details.cshtml] -->|Model| B(FieldOffice)
A -->|ViewBag| C(Jobs & Employees & Assets)
A -->|Uses| D[Syncfusion EJ2 TreeGrid]
A -->|Scripts| E{Search, Export, Formatting}
A -->|Styles| F{Bootstrap, Datepicker, Dropzone}
D --> G[Excel/PDF Export]
E --> D
E --> H[Select2 Initialization]
11. Conclusion
This Details.cshtml view provides a comprehensive, read-only snapshot of a Field Office and its related data, leveraging:
- Razor for model binding
- Bootstrap for responsive layout
- Syncfusion EJ2 TreeGrid for powerful data visualization & export
- jQuery + Select2 for enhanced client interactions
๐ Use this page to review field office configurations, drill into jobs, team members, and IT assetsโwith full export capabilities for reporting and audit purposes.