π File Documentation: IrbyImaging/Views/Imaging/FileManager.cshtml
Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- Model & ViewModel
- Layout & Structure
- Key Functional Areas
- 5.1 File Browser (Folders)
- 5.2 Search & Filter
- 5.3 Recent Files Table
- 5.4 Storage Sidebar
- Razor Logic & Data Binding
- JavaScript & Third-Party Integrations
- Sample Code Snippets
- UML Diagram
- Usage Example
- 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
DocumentImagingmodelβsSearchResultscollection. - 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
DocumentItemhas:int DocumentImageIdstring DocumentNotesDateTime DocumentUploadedDate
- Each
- The view loops over
Model.SearchResultsto 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):
- Main Content (w-100)
- Top bar: My Files title + Search Box
- Folder Grid (six cards)
- Recent Files section with a data table
- 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:
- Name (DocumentNotes + file icon)
- Date modified
- Size (hardcoded
09 KBplaceholder) - 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:
@foreachpopulates table rows@Html.DisplayForbindsDocumentNotesandDocumentUploadedDate
- ActionLink:
- Generates an anchor tag:
@Html.ActionLink("View", "ViewOCR", new { controller = "Imaging", id = item.DocumentImageId }, new { target = "_blank" })
- Generates an anchor tag:
7. JavaScript & Third-Party Integrations π οΈ
-
ApexCharts
- Render radial chart in the sidebar.
- Configuration lives in
~/js/pages/file-manager.init.js.
-
File Manager Initialization
file-manager.init.jshandles:- Chart data injection
- Responsive behaviors (e.g., sidebar toggling)
-
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
DocumentImagingobject, populatesSearchResults. - FileManager.cshtml renders the UI, calls ViewOCR for detailed view.
10. Usage Example
- Controller Action:
public ActionResult FileManager() { var viewModel = new DocumentImaging { SearchResults = _documentService.GetRecentDocuments() }; return View(viewModel); } - Navigate to
/Imaging/FileManagerβ Renders the File Manager page. - 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! π