📄 Documentation: IrbyImaging/Views/DeskPhones/History.cshtml


Table of Contents

  1. 🚀 Overview & Purpose
  2. 📋 Model & ViewModel
  3. ⚙️ Dependencies & Technologies
  4. 🔑 Key Functional Areas
  5. 🔧 Detailed Code Walkthrough
  6. 📐 UML Diagram of ViewModel
  7. 🛠️ Usage Examples
  8. 💡 Notes & Considerations
  9. ✅ Conclusion

🚀 Overview & Purpose

This Razor view (History.cshtml) is part of the DeskPhones sub‐area in the IrbyImaging web application. It renders a chronological history of a specific desk phone asset, including:

  • 🔍 Asset Details (make/model, serial number, MAC address, etc.)
  • 📆 Activity Timeline (status changes, assignments, comments)
  • 🔗 Quick Actions (back to index, view details, update)

It is designed for help‐desk or IT support personnel to track every change—who did what and when—for auditing and troubleshooting.


📋 Model & ViewModel

@model HistoryListViewModel

HistoryListViewModel (Simplified)

Property Type Description
AssetId int Unique identifier of the desk phone asset
DeskPhoneList DeskPhoneListModel Summary info (Make & Model, PhoneNumber)
Histories List Timeline events for this asset

HistoryItem (Simplified)

Property Type Description
Timestamp DateTime When the event occurred
Owner string Person assigned during that event
OwnerId int FK to Employee for linking
SomeAsset object Polymorphic asset (cast to DeskPhone)
Reason string Comments or reason for this change
Status string Asset status at this point (e.g., “Active”)
ModifiedBy string Who performed the modification

DeskPhone (Domain Class)

Property Type Description
ModelId int Internal make/model identifier
SerialNumber string Hardware serial number
PhoneNumber string Assigned phone number
MacAddress string Network MAC address
PurchaseDate DateTime Date of acquisition
Status string Current asset status
Notes string Additional remarks

⚙️ Dependencies & Technologies

Technology Purpose
ASP.NET Core MVC Razor engine for page rendering
Bootstrap 5 Responsive card, grid & button styles
Boxicons (bx) Icons for timeline & status markers
MetisMenu Sidebar menu (global layout)
SimpleBar Custom scrollbars
Waves.js Ripple & click effects

Layout Reference

Layout = "~/Views/Shared/_ATSLayout.cshtml";

🔑 Key Functional Areas

4.1 Page Metadata & Layout

@{ 
  ViewData["Title"] = "DeskPhone History"; 
  Layout = "~/Views/Shared/_ATSLayout.cshtml";
}
  • ViewData["Title"] sets the browser tab title.
  • Layout binds to the shared master page, providing the global navigation & styles.

4.2 Header & Title

<h2 style="color: #11467e"><u>DESK PHONE HISTORY</u></h2>
  • Blue underlined heading to clearly label the page.

4.3 Asset Details Section

Enclosed in a Bootstrap card, this area displays static details of the selected phone:

<div class="card-body">
  <h1 class="card-title mb-6 text-danger"><b>DETAILS</b></h1>

  <h5><b>Make/ModelId:</b> <i class="text-primary">@Model.DeskPhoneList.MakeAndModel</i></h5>
  <h5><b>Serial Number:</b> <i class="text-primary">@assetDetail.SerialNumber</i></h5>
  <h5><b>Phone Number:</b> <i class="text-primary">@Model.DeskPhoneList.PhoneNumber</i></h5>
  <h5><b>Mac Address:</b> <i class="text-primary">@assetDetail.MacAddress</i></h5>
  <h5><b>Purchase Date:</b> <i class="text-primary">@assetDetail.PurchaseDate</i></h5>
  <h5><b>Status:</b> <i class="text-primary">@assetDetail.Status</i></h5>
  <h5><b>Notes:</b>
    <pre><i class="text-primary">@assetDetail.Notes</i></pre>
  </h5>
</div>
  • assetDetail is retrieved via:
    var asset     = Model.Histories.FirstOrDefault();
    var assetDetail = asset.SomeAsset as DeskPhone;
    
  • Presents core columns in bold, with values colored using Bootstrap’s utility classes.

4.4 Activity Timeline Section

A vertical timeline lists all history events:

<ul class="verti-timeline list-unstyled">
  @foreach (var item in Model.Histories) {
    <li class="event-list">
      <div class="event-timeline-dot"><i class="bx bx-right-arrow-circle"></i></div>
      <div class="d-flex">
        <div class="flex-shrink-0 me-3">
          <i class="bx bx-time text-primary h5">@item.Timestamp</i>
        </div>
        <div class="flex-grow-1">
          <div>
            <i class="bx bx-notepad h5">
              <span class="text-danger">Comment</span> – @item.Reason
            </i>
          </div>
          <div>
            <i class="bx bx-user h5">
              <span class="text-danger">Assigned To</span> – 
              <a asp-controller="Employees" asp-action="Details" asp-route-id="@item.OwnerId">
                @item.Owner
              </a>
            </i>
          </div>
          <div>
            <i class="bx bx-analyse h5">
              <span class="text-danger">Status</span> – @item.Status
            </i>
          </div>
        </div>
      </div>
    </li>
  }
</ul>
  • Boxicons mark each event with icons for time, comments, user, and status.
  • Flex utilities (d-flex, flex-shrink-0, flex-grow-1) ensure responsive alignment.

Quick‐action buttons for navigation:

<div>
  <a asp-action="Index" class="btn btn-danger irby-red">Index List</a>
  <a asp-action="Details" asp-route-id="@Model.AssetId" class="btn btn-success irby-blue">Details</a>
  <a asp-action="Edit"    asp-route-id="@Model.AssetId" class="btn btn-warning irby-orange">Update</a>
</div>
  • Index List: Returns to the global phone inventory.
  • Details: Views the current asset details page.
  • Update: Opens the edit form for the desk phone.

🔧 Detailed Code Walkthrough

@model HistoryListViewModel
@{
  ViewData["Title"] = "DeskPhone History";
  Layout = "~/Views/Shared/_ATSLayout.cshtml";
}

// Header
<h2 style="color: #11467e"><u>DESK PHONE HISTORY</u></h2>

// Retrieve the first history item to show static details
@{
  var asset     = Model.Histories.FirstOrDefault();
  var assetDetail = asset.SomeAsset as IrbyImaging.DomainClasses.DeskPhone;
}

// DETAILS CARD
<div class="card">
  <div class="card-body">
    <h1 class="card-title mb-6 text-danger"><b>DETAILS</b></h1>
    <!-- Asset fields -->
    ...
  </div>
</div>

// ACTIVITY TIMELINE
<div class="card">
  <div class="card-body">
    <h2 class="card-title mb-6 text-danger"><b>ACTIVITY</b></h2>
    <ul class="verti-timeline">
      @foreach (var item in Model.Histories) { ... }
    </ul>
  </div>
</div>

// FOOTER BUTTONS
<div>
  <a asp-action="Index" class="btn btn-danger">Index List</a> ...
</div>

// Scripts (Bootstrap & Plugins)
<script src="~/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
...

📐 UML Diagram of ViewModel

classDiagram
    class DeskPhone {
      +int ModelId
      +string SerialNumber
      +string PhoneNumber
      +string MacAddress
      +DateTime PurchaseDate
      +string Status
      +string Notes
    }

    class HistoryItem {
      +DateTime Timestamp
      +string Owner
      +int OwnerId
      +object SomeAsset
      +string Reason
      +string Status
      +string ModifiedBy
    }

    class HistoryListViewModel {
      +int AssetId
      +DeskPhoneListModel DeskPhoneList
      +List~HistoryItem~ Histories
    }

    HistoryListViewModel --> HistoryItem : contains
    HistoryItem --> DeskPhone       : SomeAsset

🛠️ Usage Examples

Controller Action

public async Task<IActionResult> History(int id)
{
    var viewModel = await _deskPhoneService.GetHistoryAsync(id);
    return View(viewModel);
}

Render in _ATSLayout.cshtml

@RenderBody()
<script src="~/js/site.js"></script>

💡 Notes & Considerations

  • Null Checks: If Model.Histories is empty, consider displaying a “No history available” notice.
  • Performance: For long histories, you may need server‐side paging.
  • Accessibility: Ensure icons have aria-label or accompanying text for screen readers.
  • Customization: Tweak colors via CSS vars in _ATSLayout for brand compliance.

✅ Conclusion

The History.cshtml view provides a user‐friendly and visually engaging interface to monitor the lifecycle of desk phone assets. By combining Bootstrap cards, Boxicons, and an intuitive vertical timeline, it enables IT support teams to quickly diagnose issues, audit changes, and maintain a clear record of every event.

Feel free to extend this template with additional filtering, search, or export features to suit your organization’s needs.


Happy documenting! 🚀