πŸ“ File Documentation: IrbyImaging/Views/Imaging/FileManager.cshtml


Table of Contents

  1. Overview & Purpose
  2. Dependencies & Technologies
  3. Model & ViewModel
  4. Layout & Structure
  5. Key Functional Areas
  6. Razor Logic & Data Binding
  7. JavaScript & Third-Party Integrations
  8. Sample Code Snippets
  9. UML Diagram
  10. Usage Example
  11. Conclusion

1. Overview & Purpose

FileManager.cshtml serves as the View in an ASP.NET MVC pattern to display a File Manager interface for the IrbyImaging application. It presents:

  • A folder grid showing various categories (e.g., Invoices, Equipment).
  • A search bar to filter files.
  • A recent files table bound to the DocumentImaging model’s SearchResults collection.
  • A sidebar showing storage usage breakdown with a radial chart.

Users can open, edit, rename, or remove folders via dropdown menus, and view scanned OCR results of individual documents in new tabs.


2. Dependencies & Technologies

Category Library / Framework File Reference
CSS Framework Bootstrap 5 ~/libs/bootstrap/css/bootstrap.min.css
Icon Sets BoxIcons, MaterialDesignIcons <i class="bx ...">, <i class="mdi ...">
JavaScript jQuery ~/libs/jquery/jquery.min.js
Bootstrap JS ~/libs/bootstrap/js/bootstrap.bundle.min.js
MetisMenu ~/libs/metismenu/metisMenu.min.js
SimpleBar ~/libs/simplebar/simplebar.min.js
Node-Waves ~/libs/node-waves/waves.min.js
ApexCharts ~/libs/apexcharts/apexcharts.min.js
Custom Scripts File Manager Initialization ~/js/pages/file-manager.init.js
Layout Shared Layout ~/Views/Shared/_Layout.cshtml

Tip: Ensure all these scripts/CSS are included in the layout or bundler for correct rendering.


3. Model & ViewModel

@model IrbyImaging.Models.DocumentImaging
  • DocumentImaging (ViewModel) contains:
    • IEnumerable<DocumentItem> SearchResults
      • Each DocumentItem has:
        • int DocumentImageId
        • string DocumentNotes
        • DateTime DocumentUploadedDate
  • The view loops over Model.SearchResults to render the Recent Files table.

4. Layout & Structure

@{
    ViewBag.Title = "File Manager";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
  • Title set to File Manager
  • Layout references a shared master page that includes header, footer, and common scripts/styles.

The page is organized into a flex row (d-xl-flex):

  1. Main Content (w-100)
    • Top bar: My Files title + Search Box
    • Folder Grid (six cards)
    • Recent Files section with a data table
  2. Sidebar (filemanager-sidebar)
    • Storage Utilization radial chart
    • Category Cards (Images, Documents, Others)

5. Key Functional Areas

5.1 File Browser (Folders) πŸ“

  • Grid of Cards: Each card represents a folder (e.g., Invoices, Equipment).
  • Actions Dropdown:
    • Open
    • Edit
    • Rename
    • Remove
<div class="card shadow-none border">
  <div class="card-body p-3">
    <div class="float-end ms-2">
      <div class="dropdown mb-2">
        <a class="font-size-16 text-muted" role="button" data-bs-toggle="dropdown">
          <i class="mdi mdi-dots-horizontal"></i>
        </a>
        <div class="dropdown-menu dropdown-menu-end">
          <a class="dropdown-item" href="#">Open</a>
          ...
        </div>
      </div>
    </div>
    <div class="avatar-xs me-3 mb-3">
      <i class="bx bxs-folder font-size-24 text-warning"></i>
    </div>
    <h5><a href="#">Invoices</a></h5>
    <p class="text-muted">12 Files Β· 6GB</p>
  </div>
</div>

5.2 Search & Filter πŸ”

  • A text input to filter folders or files (client-side only placeholder in this view).
  • Icon using BoxIcons: <i class="bx bx-search-alt search-icon"></i>.

5.3 Recent Files Table πŸ“„

  • Renders dynamic rows from Model.SearchResults.
  • Columns:
    1. Name (DocumentNotes + file icon)
    2. Date modified
    3. Size (hardcoded 09 KB placeholder)
    4. Action β†’ View link opens OCR view in a new tab.
<tbody>
  @foreach (var item in Model.SearchResults) {
    <tr>
      <td>
        <i class="mdi mdi-file-document text-primary"></i>
        @Html.DisplayFor(m => item.DocumentNotes)
      </td>
      <td>@Html.DisplayFor(m => item.DocumentUploadedDate)</td>
      <td>09 KB</td>
      <td>
        @Html.ActionLink("View", "ViewOCR", "Imaging", new { id = item.DocumentImageId }, new { target = "_blank" })
      </td>
    </tr>
  }
</tbody>

5.4 Storage Sidebar πŸ“Š

  • Radial Chart placeholder with id="radial-chart" for ApexCharts.
  • Text summary: 48.02 GB (76%) of 64 GB used.
  • Category cards for Images, Documents, Others with file counts and sizes.

6. Razor Logic & Data Binding

  • Model Declaration:
    @model IrbyImaging.Models.DocumentImaging
    
  • Loops & DisplayFor:
    • @foreach populates table rows
    • @Html.DisplayFor binds DocumentNotes and DocumentUploadedDate
  • ActionLink:
    • Generates an anchor tag:
      @Html.ActionLink("View", "ViewOCR", new { controller = "Imaging", id = item.DocumentImageId }, new { target = "_blank" })
      

7. JavaScript & Third-Party Integrations πŸ› οΈ

  1. ApexCharts

    • Render radial chart in the sidebar.
    • Configuration lives in ~/js/pages/file-manager.init.js.
  2. File Manager Initialization

    • file-manager.init.js handles:
      • Chart data injection
      • Responsive behaviors (e.g., sidebar toggling)
  3. Core libraries

    • jQuery for DOM manipulation
    • Bootstrap for dropdowns, grid, modals
    • MetisMenu, SimpleBar, Waves for improved UI

8. Sample Code Snippets

Folder Card Template

<div class="col-xl-4 col-sm-6">
  <div class="card shadow-none border">
    <div class="card-body p-3">
      <!-- Actions -->
      <div class="float-end ms-2">
        <a data-bs-toggle="dropdown"><i class="mdi mdi-dots-horizontal"></i></a>
        <div class="dropdown-menu dropdown-menu-end">…</div>
      </div>
      <!-- Icon -->
      <div class="avatar-xs">
        <i class="bx bxs-folder font-size-24 text-warning"></i>
      </div>
      <!-- Title & Stats -->
      <h5><a href="#">Other Invoices</a></h5>
      <p class="text-muted">06 Files Β· 2GB</p>
    </div>
  </div>
</div>

Recent Files Table Row

<tr>
  <td>
    <i class="mdi mdi-file-document text-primary"></i>
    @Html.DisplayFor(m => item.DocumentNotes)
  </td>
  <td>@Html.DisplayFor(m => item.DocumentUploadedDate)</td>
  <td>09 KB</td>
  <td>
    @Html.ActionLink("View", "ViewOCR", "Imaging", new { id = item.DocumentImageId }, new { target = "_blank" })
  </td>
</tr>

9. UML Diagram

flowchart LR
  Controller[ImagingController] -->|Returns model| FileManagerView[FileManager.cshtml]
  subgraph Model
    DocumentImaging --> DocumentItem
  end
  FileManagerView -->|foreach| DocumentItem
  FileManagerView -->|ActionLink| ViewOCRAction
  FileManagerView --> ApexChartsJS
  FileManagerView --> BootstrapJS
  • ImagingController builds a DocumentImaging object, populates SearchResults.
  • FileManager.cshtml renders the UI, calls ViewOCR for detailed view.

10. Usage Example

  1. Controller Action:
    public ActionResult FileManager()
    {
        var viewModel = new DocumentImaging
        {
            SearchResults = _documentService.GetRecentDocuments()
        };
        return View(viewModel);
    }
    
  2. Navigate to /Imaging/FileManager β†’ Renders the File Manager page.
  3. Click β€œView” on a document β†’ Opens /Imaging/ViewOCR/{id} in a new tab.

11. Conclusion

FileManager.cshtml provides a clean, responsive, and extensible file management interface within the IrbyImaging application. By leveraging Razor, Bootstrap, and ApexCharts, it offers:

  • Intuitive folder navigation
  • Powerful search/filter (client-side stub)
  • Real-time recent file display
  • Visual storage analytics

βš™οΈ Developers can easily extend this view by binding additional model properties, integrating server‑side filtering, or adding modals for folder and file operations.


Happy Coding! πŸš€