JobReviewDetails.cshtml Documentation 😎

Table of Contents

  1. Overview & Purpose
  2. Dependencies & Technologies
  3. View Model & Data Models
  4. 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 πŸ“‘
  5. Helper Methods & Utilities 🧰
  6. Event Handling & JavaScript Functions 🏷️
  7. Error Handling & Return Types ⚠️
  8. Third-Party Integrations πŸ”Œ
  9. Sample Usage & Code Snippets πŸ“‹
  10. UML Diagrams πŸ“
  11. 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 dropdown
    • datasource1, datasource, datasource2 β†’ grid data sources
    • chartSource, chartSourcecieb, chartSourcebiec, etc. β†’ chart data
    • Employees, 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:

  1. Revenue & Cost (StackingLine)
  2. CIEB / BIEC (StackingColumn)
  3. Margin (Column)
  4. 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 dataBound event:
    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 .anchorDetail click
  • 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 .anchorDetail includes .error() with an alert().
  • If no job selected / data missing, grids render empty.
  • Server‑side: If an invalid jobnumber is 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);
}
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. πŸš€