📄 ShowAssetsForITReview.cshtml Documentation


📑 Table of Contents

  1. Overview & Purpose
  2. Dependencies & Technologies
  3. ViewModel & DataModel
  4. UI Layout & Styling
  5. Main Functional Areas
  6. Helper Methods & Utilities
  7. Error Handling & Return Types
  8. API Endpoints Overview
  9. Third‑party Integrations
  10. UML Class Diagram
  11. Usage Examples
  12. Conclusion

1. Overview & Purpose

📝 ShowAssetsForITReview.cshtml is an ASP.NET Core Razor view responsible for rendering a Total Assets View tailored for IT review. It presents a rich, interactive grid (using Syncfusion EJ2) of company assets (phones, laptops, etc.), enabling:

  • Sorting, filtering, grouping
  • Excel/PDF export
  • Inline editing
  • Row‑drag & drop
  • Search & clear search

Additionally, it provides a Download Assets that needs IT Review button to bulk-download assets as a ZIP.


2. Dependencies & Technologies

Technology/Package Purpose
ASP.NET Core Razor Pages Server‑side view rendering
Syncfusion.EJ2 Grid controls, Excel/PDF export
Syncfusion.JavaScript.Models Filter/Group/Edit settings
Bootstrap 4 (assumed) Responsive grid layout
Custom CSS Styling grid headers, icons, cells

3. ViewModel & DataModel

Razor Directive

@model IrbyImaging.UI.Models.AssetsView

Assumed ViewModel Structure

public class AssetsView {
    public List<Asset> Assets { get; set; }
    // ... other paging/filtering metadata
}

public class Asset {
    public string FieldOfficeNumber { get; set; }
    public string FieldOfficeName   { get; set; }
    public string JobNumber         { get; set; }
    public string JobName           { get; set; }
    public int    EmployeeNumber    { get; set; }
    public string EmploymentStatus  { get; set; }
    public string EmployeeName      { get; set; }
    public string Type              { get; set; }
    public string Category          { get; set; }
    public string ModelName         { get; set; }
    public string PhoneNumber       { get; set; }
    public string AssetNumber       { get; set; }
    public string SerialNumber      { get; set; }
    public string Status            { get; set; }
    public bool   IsTelogis         { get; set; }
}

Data Binding

dataSource="@ViewBag.datasource"

The controller should populate ViewBag.datasource with the List<Asset>.


4. UI Layout & Styling

4.1 Layout Declaration

@{
    ViewData["Title"] = "Assets List";
    Layout = "~/Views/Shared/_ATSLayout.cshtml";
}
  • Title appears in the browser tab.
  • Layout points to a shared master page with header/sidebar nav.

4.2 Custom CSS

<style>
  .e-grid .e-headercell      { color: darkblue; }
  .e-grid .e-gridheader      { border: 2px solid black; }
  .e-grid .e-sortnumber      { background-color: #deecf9; }
  /* ... other grid styles for icons, grouping, indenting ... */
</style>
  • Adjusts grid header, sort indicators, group captions, etc.
  • Ensures visual consistency with corporate branding.

5. Main Functional Areas

5.1 Download Button

<div class="col-lg-2">
  <a asp-action="DownloadZipForITReview"
     class="btn btn-success irby-green">
    📦 Download Assets that needs IT Review
  </a>
</div>
  • Action: DownloadZipForITReview in ATSHomeController.
  • Result: Streams a ZIP with selected assets and attachments.

5.2 Syncfusion EJ2 Grid

<ejs-grid id="Grid"
          allowSorting="true"
          allowFiltering="true"
          allowGrouping="true"
          allowPaging="true"
          allowExcelExport="true"
          allowPdfExport="true"
          allowRowDragAndDrop="true"
          toolbar="@(new List<string>(){"ExcelExport","PdfExport","Search"})"
          dataSource="@ViewBag.datasource"
          toolbarClick="toolbarClick">
  <e-grid-filterSettings type="Excel"></e-grid-filterSettings>
  <e-grid-editSettings allowAdding="true"
                       allowEditing="true"
                       allowDeleting="true"
                       edit-mode="@(EditMode.Normal)"></e-grid-editSettings>
  <e-grid-columns>
    <!-- Column definitions -->
  </e-grid-columns>
</ejs-grid>

Key Grid Features

  • Excel/PDF Export via toolbar.
  • Search integrated in toolbar.
  • Inline CRUD capabilities.
  • Grouping by FieldOfficeNumber.
Column Field Header Text Type Width Notes
FieldOfficeNumber FieldOffice# string 70 Primary Key, Centered
FieldOfficeName FieldOfficeName string 110
JobNumber Job# string 70
JobName Job Name string 110
EmployeeNumber AssignedTo# int 70
EmploymentStatus Employment Status string 75 Centered
EmployeeName Employee Name string 110
Type Asset Type string 70 Left align
Category Category string 75 Left align
ModelName Model string 110
PhoneNumber Phone# string 80 Centered
AssetNumber Asset# string 110 Centered
SerialNumber Serial# string 110
Status Asset Status string 75 Centered
IsTelogis Is Telogis bool 70

5.3 Toolbar & Export Functions

<script>
  function toolbarClick(args) {
    var gridObj = document.getElementById("Grid").ej2_instances[0];
    if (args.item.id === 'Grid_excelexport') {
      gridObj.excelExport();
    }
    if (args.item.id === 'Grid_pdfexport') {
      gridObj.pdfExport();
    }
  }
</script>
  • Unified toolbarClick handles both Excel & PDF export.
  • Fix: Merge duplicate definitions into one (as shown above).

5.4 Clear Search Utility

<script>
  document.getElementById('clear')
          .addEventListener('click', () => {
    var gridObj = document.getElementById("Grid")
                       .ej2_instances[0];
    gridObj.searchSettings.key = '';
  });
</script>
  • Clears the Search textbox in the toolbar.

6. Helper Methods & Utilities

  • DownloadZipForITReview (Controller): Prepares and returns a ZIP.
  • ViewBag.datasource: Temporary holder for List<Asset>.
  • Custom CSS classes for fine‑tuning Syncfusion theming.

7. Error Handling & Return Types

  • The view itself has no explicit error handling; relies on:
    • Controller to validate and handle exceptions.
    • Syncfusion to display grid‑level errors.

8. API Endpoints Overview

Endpoint HTTP Verb Description
/ATSHome/ShowAssetsForITReview GET Renders this view with the asset list.
/ATSHome/DownloadZipForITReview GET/POST* Streams a ZIP of assets for IT review.

*Actual verb depends on controller signature.


9. Third‑party Integrations

  • Syncfusion EJ2: Grid, Filtering, Grouping, Export.
  • Bootstrap: Layout (rows/columns, buttons).

10. UML Class Diagram

classDiagram
    class AssetsView {
        +List~Asset~ Assets
        +int PageSize
        +int PageNumber
    }
    class Asset {
        +string FieldOfficeNumber
        +string FieldOfficeName
        +string JobNumber
        +string JobName
        +int EmployeeNumber
        +string EmploymentStatus
        +string EmployeeName
        +string Type
        +string Category
        +string ModelName
        +string PhoneNumber
        +string AssetNumber
        +string SerialNumber
        +string Status
        +bool IsTelogis
    }
    AssetsView --> Asset

💡 Use the above as guidance; adjust properties to match your actual Models.


11. Usage Examples

11.1 Controller Action (C#)

public IActionResult ShowAssetsForITReview()
{
    var assets = _assetService.GetAssetsForReview();
    ViewBag.datasource = assets;
    return View(new AssetsView { Assets = assets });
}

public FileResult DownloadZipForITReview()
{
    var zipBytes = _assetService.GenerateReviewZip();
    return File(zipBytes, "application/zip", "AssetsForITReview.zip");
}

11.2 Customizing Columns

To add a Warranty Expiration column:

<e-grid-column field="WarrantyExpiry"
               headerText="Warranty Expiry"
               format="yMd"
               width="100">
</e-grid-column>

12. Conclusion

✅ ShowAssetsForITReview.cshtml provides a powerful, interactive interface for IT to review and export company assets.

  • Syncfusion EJ2 ensures a full set of grid features (sorting, filtering, exporting).
  • Custom styling aligns with corporate branding.
  • Download button streamlines bulk retrieval.

With this documentation, you should have a clear understanding of how to integrate, customize, and extend this view in your ASP.NET Core MVC project. Feel free to adjust styling, grid settings, or columns to match evolving business requirements. Happy coding! 🎉