đ Documentation: IrbyImaging/Views/LegalImaging/DocPreview.cshtml
Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- View Model:
DocumentImaging - Key Functional Areas
4.1 Data Initialization
4.2 Styling & Assets
4.3 Form Generation & Submission
4.4 Document Thumbnails & Preview - API Endpoints Overview
- Helper Methods & Utilities
- Error Handling & Confirmation
- ThirdâParty Integrations
- UML Diagrams
- Sample Code Blocks & Usage Examples
- Conclusion
1. Overview & Purpose
This Razor view (DocPreview.cshtml) is part of the Legal Imaging module in the IrbyImaging application. It provides a user interface for:
- Previewing uploaded PDF documents đ°
- Selecting multiple documents for indexing đ
- Deleting unwanted documents â
It renders a grid of document thumbnails, supports âSelect Allâ functionality, and uses AJAX to load preview details in a modal dialog. Submissions are posted to the SaveDocument action in the LegalImaging controller.
2. Dependencies & Technologies
| Category | Library / Framework | Usage |
|---|---|---|
| Frontâend CSS | Bootstrap, Dropzone, BootstrapâDatepicker | Layout, file-drop styling, datepickers |
| JavaScript & UI | jQuery, Bootstrap, MetisMenu, SimpleBar, Waves | DOM manipulation, modals, menus |
| Rich Text Editor | TinyMCE | (Loaded but not used in this view) |
| Serverâside | ASP.NET Core MVC Razor Views | View rendering & model binding |
Key Assets Loaded
<link href="~/assets/libs/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet">
<link href="~/assets/libs/dropzone/min/dropzone.min.css" rel="stylesheet">
<script src="~/assets/libs/jquery/jquery.min.js"></script>
<script src="~/assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- ... other libs ... -->
<script src="~/assets/libs/tinymce/tinymce.min.js"></script>
3. View Model: DocumentImaging
This view binds to the IrbyImaging.Models.DocumentImaging model.
| Property | Type | Description |
|---|---|---|
DocumentImageId |
Guid |
Unique identifier for the overall document batch |
BatchIds |
List<Guid> |
Collection of individual document GUIDs to preview/index |
ImagingType |
string |
Category or process type (from ViewBag.category) |
IsLegalDocument |
bool |
Flag indicating a legal document |
IsSafety |
bool |
Flag indicating a safety-related document |
DeleteFiles |
bool |
Toggle for deletion of selected documents |
4. Key Functional Areas
4.1 Data Initialization
@model IrbyImaging.Models.DocumentImaging
@{
ViewData["Title"] = "Save Uploaded Document";
Layout = "~/Views/Shared/_LegalLayout.cshtml";
var lists = new List<Guid>();
string guidList = "";
var category = ViewBag.category;
if (Model?.BatchIds != null) {
lists = Model.BatchIds;
foreach (var id in lists) {
guidList += id + ",";
}
}
}
ViewData["Title"]sets the page title dynamically.Layoutpoints to the shared legal layout.lists&guidListaccumulate a commaâseparated list of Batch IDs for potential clientâside use.categoryis pulled fromViewBag(controller sets this).
4.2 Styling & Assets
- CSS Includes
bootstrap-datepicker.min.cssdropzone.min.css
- Inline Styles
.flex-container { display: flex; flex-wrap: wrap; } .flex-container > div { background-color: #f1f1f1; /* etc. */ } - Layout: a series of
<div class="row">and<div class="col-md-3">blocks form a responsive grid.
4.3 Form Generation & Submission
Depending on the number of documents (BatchIds.Count), the view renders a single or multiâdocument form. Both post to:
POST /LegalImaging/SaveDocument?category={category}
Form Example (multiâdocument)
@using (Html.BeginForm("SaveDocument", "LegalImaging", new { category = category }, FormMethod.Post, null, Model))
{
@Html.HiddenFor(m => m.DocumentImageId)
@Html.HiddenFor(m => m.BatchIds)
@Html.HiddenFor(m => m.ImagingType)
@Html.HiddenFor(m => m.IsLegalDocument)
@Html.HiddenFor(m => m.IsSafety)
@Html.HiddenFor(m => m.DeleteFiles)
<div class="preference">
<label>Select All</label>
<input id="ckbCheckAll" type="checkbox" />
<div style="float:right;">
<input type="submit" class="btn btn-primary" value="Index Selected Documents" />
<button type="submit" onclick="deleteFiles();" class="btn btn-danger">Delete</button>
</div>
</div>
<!-- Document grid here -->
}
- HiddenFor fields ensure model integrity on postback.
Index Selected Documentssubmits for indexing;Deletetriggers a confirmation via JavaScript.
4.4 Document Thumbnails & Preview
Each BatchId generates:
- An
<embed>PDF preview - A Select checkbox
- A Preview link (AJAX modal)
@for (int k = 0; k < Model.BatchIds.Count; k++) {
var id = Model.BatchIds[k];
<div class="col-md-3">
<div class="thumbnail">
<embed src="@Url.Action("Preview","LegalImaging", new { id = id })#zoom=FitH" type="application/pdf" />
<div class="preference">
<label>Select</label>
<input class="checkBoxClass" type="checkbox" name="docIds" value="@id" />
</div>
<a href="javascript:void(0);" class="previewDetail" data-id="@id">Preview</a>
<!-- Modal placeholder -->
<div id="myModal" class="modal">
<div class="modal-dialog">
<div class="modal-content">
<div id="myModalContent"></div>
</div>
</div>
</div>
</div>
</div>
}
- Grid Layout: 4 items per row, new
<div class="row">created every 4 thumbnails. embedtag renders inline PDF previews.- AJAX Preview uses the
.previewDetaillink to fetch details without fullâpage refresh.
5. API Endpoints Overview
| Endpoint | Method | Description |
|---|---|---|
/LegalImaging/DocPreview |
GET | Renders this view with a DocumentImaging model |
/LegalImaging/SaveDocument?category={cat} |
POST | Handles indexing & deletion on server side |
/LegalImaging/Preview?id={batchId} |
GET | Returns raw PDF for <embed> tag |
/LegalImaging/myModalPreview |
GET | Returns partial HTML for AJAX modal preview |
6. Helper Methods & Utilities
Html.BeginForm(...)â generates the<form>tag with route values.Html.HiddenFor(...)â stronglyâtyped hidden inputs for model binding.Url.Action(...)â constructs URLs for controller actions.
No custom helper extensions are used in this view.
7. Error Handling & Confirmation
Deletion Confirmation
function deleteFiles() {
var r = confirm("Are you sure you want to delete the selected documents?");
if (!r) {
return false;
}
$("#DeleteFiles").attr("value", "True");
}
confirm()ensures user acknowledgment before deletion.- Sets the hidden field
DeleteFiles=truefor serverâside logic.
AJAX Error Handling
$.ajax({
// ...
error: function () {
alert("Dynamic content load failed.");
}
});
- Alerts the user if the preview partial fails to load.
8. ThirdâParty Integrations
| Integration | Description |
|---|---|
| Bootstrap | Responsive grid, buttons, modals |
| jQuery | DOM manipulation, AJAX |
| BootstrapâDatepicker | Date picker styling (not used here) |
| Dropzone | Dragâandâdrop upload styling (CSS only) |
| TinyMCE | Rich text editor (JS loaded, unused) |
| MetisMenu | Sidebar menu behavior |
| SimpleBar | Custom scrollbars |
| Waves | Ripple effects on clicks |
9. UML Diagrams
9.1 Class Diagram
classDiagram
class DocumentImaging {
+Guid DocumentImageId
+List<Guid> BatchIds
+string ImagingType
+bool IsLegalDocument
+bool IsSafety
+bool DeleteFiles
}
class LegalImagingController {
+IActionResult DocPreview(List<Guid> batchIds, string category)
+IActionResult SaveDocument(DocumentImaging model, string category)
+FileStreamResult Preview(Guid id)
+IActionResult myModalPreview(Guid id, bool Preview)
}
LegalImagingController --> DocumentImaging
9.2 Sequence Diagram
sequenceDiagram
participant U as User
participant V as DocPreview View
participant C as LegalImagingController
U->>V: Request /LegalImaging/DocPreview
V-->>U: Renders grid of thumbnails
U->>V: Click âPreviewâ link
V->>C: AJAX GET /myModalPreview?id={id}
C-->>V: Partial HTML (modal content)
V-->>U: Show modal dialog
U->>V: Click âIndex Selected Documentsâ
V->>C: POST /SaveDocument
C-->>U: Redirect / Success message
10. Sample Code Blocks & Usage Examples
10.1 Controller Example
public class LegalImagingController : Controller
{
[HttpGet]
public IActionResult DocPreview(List<Guid> batchIds, string category)
{
var model = new DocumentImaging {
DocumentImageId = Guid.NewGuid(),
BatchIds = batchIds ?? new List<Guid>(),
ImagingType = category,
IsLegalDocument = true,
IsSafety = false
};
ViewBag.category = category;
return View("DocPreview", model);
}
[HttpPost]
public IActionResult SaveDocument(DocumentImaging model, string category)
{
if (model.DeleteFiles)
{
// Delete logic...
}
else
{
// Indexing logic...
}
return RedirectToAction("IndexComplete");
}
[HttpGet]
public FileStreamResult Preview(Guid id)
{
// Retrieve PDF by id
var stream = _service.GetPdfStream(id);
return File(stream, "application/pdf");
}
[HttpGet]
public IActionResult myModalPreview(Guid id, bool Preview)
{
var detail = _service.GetDocumentDetail(id);
return PartialView("_PreviewDetail", detail);
}
}
10.2 How to Use
- Upload documents using your upload interface (not in this view).
- Navigate to
/LegalImaging/DocPreview?batchIds={commaSeparatedGuids}&category=Legal. - Select individual or âSelect Allâ documents.
- Click Index Selected Documents to commit indexing or Delete to remove.
- Click Preview to view details in a modal popup.
11. Conclusion
This DocPreview.cshtml file is the central UI for indexing and previewing legal documents in the IrbyImaging system. It demonstrates:
- Razor-based model binding and form generation
- Responsive thumbnail grid using Bootstrap
- Inline PDF preview and AJAXâdriven modals
- Bulk actions (select all, index, delete) with clientâside safeguards
By leveraging standard ASP.NET Core MVC patterns and common frontâend libraries, it provides a userâfriendly interface for document management in a legal context. đ
End of Documentation
Generated with care to guide future developers and maintainers.