📄 Outstanding.cshtml Documentation


📑 Table of Contents

  1. Overview & Purpose
  2. Dependencies & Technologies
  3. ViewModel & Data Model
  4. Layout & ViewData
  5. UI Structure & Key Functional Areas
  6. JavaScript & Third‑Party Integrations
  7. Error Handling & Edge Cases
  8. UML Class Diagram
  9. Sample Usage & Controller Snippet
  10. Conclusion

🔍 Overview & Purpose

Outstanding.cshtml is an ASP.NET Core Razor View under the IrbyImaging/Views/Employees folder. Its primary goal is to display a paginated, searchable list of “Outstanding Assets” assigned to employees.

  • It leverages a strongly-typed IEnumerable<OutstandingViewModel>.
  • Presents summary badges, search capability, and contextual action buttons (Details, Update, History).
  • Part of an internal ATS (Asset Tracking System) layout.

🛠️ Dependencies & Technologies

Technology / Library Purpose
ASP.NET Core MVC Razor Server‑side view rendering
Bootstrap 4.x / 5.x Responsive UI & styling (table, btn, badge)
MetisMenu Sidebar menu handling
SimpleBar Custom scrollbars
Waves.js Ripple click effects
Layout: _ATSLayout.cshtml Shared master layout for ATS theme

📊 ViewModel & Data Model

This view expects the following OutstandingViewModel properties:

Property Type Description
Category string Asset category (e.g., Laptop, Camera)
MakeAndModel string Vendor make and model
SerialNumber string Unique asset serial number
OwnerId Guid Employee (owner) identifier
OwnerFullName string Employee full name
PurchaseDate DateTime Date of asset purchase
Status string Asset current status (e.g., “Active”)
Id Guid Asset record identifier
Controller string MVC controller name for routing
public class OutstandingViewModel
{
    public string   Category       { get; set; }
    public string   MakeAndModel   { get; set; }
    public string   SerialNumber   { get; set; }
    public Guid     OwnerId        { get; set; }
    public string   OwnerFullName  { get; set; }
    public DateTime PurchaseDate   { get; set; }
    public string   Status         { get; set; }
    public Guid     Id             { get; set; }
    public string   Controller     { get; set; }
}

🏗️ Layout & ViewData

@{
    ViewData["Title"] = "Outstanding List";
    Layout           = "~/Views/Shared/_ATSLayout.cshtml";
}
  • ViewData["Title"]: Sets the page title to “Outstanding List.”
  • Layout: Uses a shared ATS theme layout for consistent headers, footers, and sidebars.

🔨 UI Structure & Key Functional Areas

5.1 Header & Badge

<h2>
  Outstanding Assets
  <span class="badge irby-red">@Model.Count()</span>
</h2>
  • Displays the total count of outstanding assets in a red badge.
  • Dynamic: @Model.Count() updates automatically as the model changes.

5.2 Search Form

<form asp-action="Outstanding" method="get" class="form-inline">
  <div class="input-group">
    <input type="text" name="search" class="form-control" placeholder="Search for..." />
    <span class="input-group-btn">
      <button type="submit" class="btn btn-primary irby-blue">Search</button>
    </span>
  </div>
</form>
  • Method: GET
  • Action: Outstanding (same view)
  • Parameters:
    • search (string) – filters assets by Category, SerialNumber, OwnerFullName, etc.

5.3 Assets Table

<table class="table table-striped table-hover text-nowrap">
  <thead>
    <tr>
      <th>@Html.DisplayNameForInnerType((OutstandingViewModel m) => m.Category)</th>
      <!-- other headers omitted for brevity -->
      <th></th> <!-- Actions column -->
    </tr>
  </thead>
  <tbody>
    @foreach (var item in Model) {
      <tr>
        <td>@Html.DisplayFor(m => item.Category)</td>
        <!-- other cells omitted -->
        <td>
          <!-- Action buttons -->
        </td>
      </tr>
    }
  </tbody>
</table>
  • table-striped: Alternating row colors for readability.
  • table-hover: Highlights row on mouseover.
  • text-nowrap: Prevents cell content from wrapping.

5.4 Action Buttons

Button Controller Action Route Param CSS Class Emoji
Details @item.Controller Details @item.Id btn-sm btn-primary irby-blue 🔍
Update @item.Controller Edit @item.Id btn-sm btn-primary irby-orange ✏️
History @item.Controller History @item.Id btn-sm btn-primary irby-violet 📜
<a asp-controller="@item.Controller" asp-action="Details" asp-route-id="@item.Id" class="btn-sm btn-primary irby-blue">Details</a>

⚙️ JavaScript & Third‑Party Integrations

<script src="~/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="~/libs/metismenu/metisMenu.min.js"></script>
<script src="~/libs/simplebar/simplebar.min.js"></script>
<script src="~/libs/node-waves/waves.min.js"></script>
  • Bootstrap: Modal, dropdown, and general UI behaviors.
  • MetisMenu: Collapsible sidebar menus.
  • SimpleBar: Custom scrollbars for overflow areas.
  • Waves.js: Material-style wave effect on buttons.

🚧 Commented Code
An old autocomplete search snippet is commented out and ready for future quick-employee lookup via jQuery UI.


🚨 Error Handling & Edge Cases

  • Empty Model: Renders a table header with zero rows.
  • No Search Results: Badge shows 0, table empty.
  • Long Texts: text-nowrap prevents wrapping—may cause overflow.
  • Route Errors: Invalid @item.Id or @item.Controller could result in 404 from the MVC router.

📐 UML Class Diagram

classDiagram
    OutstandingViewModel {
        +string Category
        +string MakeAndModel
        +string SerialNumber
        +Guid OwnerId
        +string OwnerFullName
        +DateTime PurchaseDate
        +string Status
        +Guid Id
        +string Controller
    }

🔄 Sample Usage & Controller Snippet

public class EmployeesController : Controller
{
    // GET: /Employees/Outstanding
    public IActionResult Outstanding(string search)
    {
        var assets = _assetService
            .GetOutstandingAssets()
            .Where(a => string.IsNullOrEmpty(search)
                     || a.SerialNumber.Contains(search)
                     || a.OwnerFullName.Contains(search))
            .Select(a => new OutstandingViewModel {
                Category      = a.Category,
                MakeAndModel  = $"{a.Make} {a.Model}",
                SerialNumber  = a.Serial,
                OwnerId       = a.Owner.Id,
                OwnerFullName = a.Owner.FullName,
                PurchaseDate  = a.PurchaseDate,
                Status        = a.Status,
                Id            = a.Id,
                Controller    = "Assets"
            })
            .ToList();
        return View(assets);
    }
}
@* Usage: Navigate to /Employees/Outstanding?search=Camera *@

🏁 Conclusion

  • Outstanding.cshtml offers a clean, interactive interface for displaying and managing outstanding assets.
  • Its modular structure (badge, search, table, actions) promotes maintainability and extensibility.
  • Leveraging ASP.NET Core MVC, Bootstrap, and lightweight plugins, it fits seamlessly into the ATS ecosystem.

📌 Tip: You can uncomment and enhance the jQuery UI autocomplete snippet for a richer UX in quick employee searches.


✨ Thank you for exploring the documentation for Outstanding.cshtml! ✨