JobReviewDetails.cshtml Documentation π
Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- View Model & Data Models
- Page Structure & Key Functional Areas
4.1 Layout & Global Styles π¨
4.2 Section Navigator π
4.3 Job Selection Form π
4.4 Job Summary Display π
4.5 Financial Summary Grid π
4.6 Charts Section π
4.7 Detailed Data Grids ποΈ
4.8 Modal Dialog for Documents π - Helper Methods & Utilities π§°
- Event Handling & JavaScript Functions π·οΈ
- Error Handling & Return Types β οΈ
- Third-Party Integrations π
- Sample Usage & Code Snippets π
- UML Diagrams π
- Conclusion β
1. Overview & Purpose π
The JobReviewDetails.cshtml Razor view in IrbyImaging/Views/IView provides a comprehensive dashboard for reviewing job details, financials, and operational data in one place. Key features include:
- π Job selection and summary
- π Financial summary grids
- π Interactive charts (revenue, cost, margin, unbilled)
- ποΈ Data grids for revenue/cost details, ledger, employees, equipment, work orders, POs, IT assets
- π€ Export to Excel/PDF/CSV
- π In-page navigation and search
2. Dependencies & Technologies π οΈ
| Technology / Library | Purpose |
|---|---|
| ASP.NET Core MVC (Razor) | Server-side view rendering |
| Syncfusion EJ2 | Rich UI: Grid, Chart, TextBox, Button |
| jQuery | DOM manipulation, event handling, AJAX |
| Select2 | Enhanced searchable dropdown |
| Bootstrap 5 | Responsive layout, modal dialog |
| DataTables Buttons & JSZip | Client-side export functionality |
| Newtonsoft.Json | JSON serialization |
3. View Model & Data Models π¦
@model IrbyImaging.UI.Models.Balances
- Balances
Job(holds job metadata)Details(collection, e.g. leads)
- ViewBag containers:
jobsβ<SelectListItem>list for the job dropdowndatasource1,datasource,datasource2β grid data sourceschartSource,chartSourcecieb,chartSourcebiec, etc. β chart dataEmployees,Equipment,WorkOrder,WorkOrderNO,PurchaseOrder,Assetsβ various grid sources
4. Page Structure & Key Functional Areas π
4.1 Layout & Global Styles π¨
@{ Layout = "~/Views/Shared/_iViewLayout.cshtml"; }
<style>
.floating-save-btn { position: fixed; bottom: 25px; right: 80px; z-index: 1000; }
.neumorphic-button { /* custom button styling */ }
</style>
- Uses a shared layout
_iViewLayout.cshtml. - Defines floating nav button & neumorphic submit button styles.
4.2 Section Navigator π
A fixed <select> dropdown to jump to page sections:
<SELECT id="Select" class="floating-save-btn">
<OPTION value="#Summary">Summary</OPTION>
<OPTION value="#ChartSummary">Charts</OPTION>
<!-- etc. -->
</SELECT>
<script>
$("#Select").change(function() {
window.location.href = $(this).val();
});
</script>
- In-page navigation for a long dashboard.
4.3 Job Selection Form π
<form asp-controller="IView" asp-action="JobReviewDetails" method="post">
<select id="dropdown" name="jobnumber" class="form-control" style="width:100%">
<option value="">Select a Jobβ¦</option>
@foreach (var item in ViewBag.jobs as List<SelectListItem>) {
<option value="@item.Value">@item.Text</option>
}
</select>
<button type="submit" class="neumorphic-button mt-3">Submit</button>
</form>
-
Select2 enhancement:
$('#dropdown').select2({ placeholder: "Select a Jobβ¦", allowClear: true, width: '360px' }); -
POST to
IViewController.JobReviewDetails(int jobnumber).
4.4 Job Summary Display π
Readβonly Syncfusion TextBoxes:
<ejs-textbox id="number" value="@Model.Job.JdeNumber" readonly></ejs-textbox>
<ejs-textbox id="name" value="@Model.Job.Name" readonly></ejs-textbox>
<!-- ContractType, JobType, WorkType, FieldOfficeName, CustomerName, GeoRegionDescription -->
- Groups fields in bootstrap grid rows.
- Last row shows planned/actual start and completion dates.
4.5 Financial Summary Grid π
Syncfusion ejs-grid with stacked columns:
<ejs-grid id="TreeGrid1" dataSource="ViewBag.datasource1"
allowExcelExport="true" allowPdfExport="true" ...>
<e-grid-column field="JobName" headerText="JOB" width="290"></e-grid-column>
<e-grid-column headerText="CURRENT MONTH">
<e-gridcolumn-stackedcolumn field="Revenue" headerText="REVENUE"></e-gridcolumn-stackedcolumn>
<e-gridcolumn-stackedcolumn field="Cost" headerText="COST"></e-gridcolumn-stackedcolumn>
<e-gridcolumn-stackedcolumn field="Margin" headerText="MARGIN"></e-gridcolumn-stackedcolumn>
<e-gridcolumn-stackedcolumn field="MarginPct" headerText="MARGIN %"></e-gridcolumn-stackedcolumn>
</e-grid-column>
<e-grid-column headerText="YEAR-TO-DATE">
<!-- YTDRevenue, YTDCost, YTDMargin, ... -->
</e-grid-column>
</ejs-grid>
- Stacked Columns group related metrics.
- Builtβin export to Excel & PDF.
4.6 Charts Section π
Four charts with Syncfusion:
- Revenue & Cost (StackingLine)
- CIEB / BIEC (StackingColumn)
- Margin (Column)
- Unbilled (Column)
<ejs-chart id="container1" title="Revenue and Cost by Month">
<e-series dataSource="ViewBag.chartSource" name="Revenue" type="StackingLine"></e-series>
<e-series dataSource="ViewBag.chartSource" name="Cost" type="StackingLine"></e-series>
</ejs-chart>
4.7 Detailed Data Grids ποΈ
| Section | GridΒ ID | DataSource |
|---|---|---|
| Revenue & Cost by Job | TreeGrid |
ViewBag.datasource |
| Account Ledger Details | TreeGrid2 |
ViewBag.datasource2 |
| Total Employees | grid2 |
ViewBag.Employees |
| Equipment List | grid4 |
ViewBag.Equipment |
| Work Orders β Equipment | grid6 |
ViewBag.WorkOrder |
| Work Orders β NonβEquipment | grid8 |
ViewBag.WorkOrderNO |
| Purchase Orders | grid5 |
ViewBag.PurchaseOrder |
| IT Assets | grid7 |
ViewBag.Assets |
Common features:
- Tree data with
childMapping. - Toolbar for Excel/PDF export.
- Search text + button β
grid.search(val). - Paging, filtering, sorting, grouping, resizing.
4.8 Modal Dialog for Documents π
<div id="myModal" class="modal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div id="myModalContent"></div>
</div>
</div>
</div>
$('body').on('click', '.anchorDetail', function(){
var id = $(this).data('id');
$.ajax({
url: '/IView/DocumentView',
data: { id: id },
success: function(html) {
$('#myModalContent').html(html);
$('#myModal').modal('show');
},
error: function() { alert("Dynamic content load failed."); }
});
});
- Dynamically fetches detail HTML and displays it in a Bootstrap modal.
5. Helper Methods & Utilities π§°
- Autoβfit columns in each gridβs
dataBoundevent:function dataBound1(args) { this.autoFitColumns(['JobName','Revenue','Cost',...]); } - Load handlers to apply column formats (dates):
function load6(args){ this.columns[10].format = { type:'date', format:'MM/dd/yyyy' }; // ... } - toolbarClick: customizes export behavior, preserves collapsed state:
function toolbarClick(args) { var gridObj = this; if (args.item.id.endsWith('_excelexport')) gridObj.excelExport({ isCollapsedStatePersist: collapsedStatePersist }); // PDF & CSV similarly }
6. Event Handling & JavaScript Functions π·οΈ
- Section jump β
#Select.change() - Select2 init β
$(document).ready() - Search β
element.addEventListener('click', β¦ grid.search(val)) - Modal β delegated
.anchorDetailclick - Grid lines toggle β multiple
onChange(e)functions per grid
π Note: Several functions are similarly defined per grid (could be DRYβimproved).
7. Error Handling & Return Types β οΈ
- AJAX call on
.anchorDetailincludes.error()with analert(). - If no job selected / data missing, grids render empty.
- Serverβside: If an invalid
jobnumberis posted, controller may return an empty model.
8. Third-Party Integrations π
- Syncfusion EJ2 (License required)
- Select2 for searchable dropdown
- DataTables Buttons & JSZip / pdfmake (some export scripts included)
- Bootstrap (modal, grid system)
- jQuery (core library)
9. Sample Usage & Code Snippets π
Controller GET
[HttpGet]
public IActionResult JobReviewDetails() {
ViewBag.jobs = _jobService.GetAllJobs();
return View(new Balances());
}
Controller POST
[HttpPost]
public IActionResult JobReviewDetails(int jobnumber) {
var model = _balancesService.GetBalances(jobnumber);
ViewBag.datasource1 = model.FinancialSummary;
ViewBag.chartSource = model.ChartData;
// β¦ populate other ViewBags β¦
return View(model);
}
Triggering a Search
document.getElementById('Search6').addEventListener('click', function(){
var grid = document.getElementById('grid6').ej2_instances[0];
grid.search(document.getElementById('searchText6').value);
});
10. UML Diagrams π
Class Diagram
classDiagram
class Balances {
+Job Job
+List<Detail> Details
}
class Job {
+string JdeNumber
+string Name
+string ContractType
+string JobType
+string WorkType
+string FieldOfficeName
+string CustomerName
+string GeoRegionDescription
+string ManagerName
+string SuperintendentName
+string ProjectEstimatorName
+DateTime DatePlannedStart
+DateTime DateActualStart
+DateTime DatePlannedComplete
+DateTime DateActualComplete
}
class Detail {
+string Lead
}
Balances "1" o-- "1" Job
Balances "1" o-- "*" Detail
11. Conclusion β
The JobReviewDetails.cshtml view is a powerful, dataβrich dashboard that consolidates job metadata, financial KPIs, operational charts, and detailed drillβdownsβall in one place. By leveraging Syncfusion components, Select2, and Bootstrap, it provides:
- A streamlined experience for heavy data review
- Interactive filtering, searching, and exporting
- Modular sections with in-page navigation
Understanding its structure, data flows, and event wiring is key to maintaining and extending this dashboard for future business needs. π