📄 deleteModal.cshtml Documentation
Path:
IrbyImaging/Views/Imaging/deleteModal.cshtml
🗂️ Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- View Model
- Template Structure & Key Areas
- 4.1 Modal Container
- 4.2 Header Section
- 4.3 Body Section
- 4.4 Footer Section
- API Endpoints Overview
- Third‑party Integrations
- Helper Methods / Utilities
- Error Handling & Return Types
- UML Diagram
- Sample Code Block
- Usage Examples
- Conclusion
1. Overview & Purpose
The deleteModal.cshtml file defines a Bootstrap modal dialog that displays a PDF preview of a document marked for deletion (or viewing) in the IrbyImaging system. This modal is typically invoked when a user clicks on a "Delete" or "View Document" button within the Imaging area of the web application.
- Primary Goal: Provide a quick, inline document preview (PDF) inside a modal.
- User Interaction:
- Print Document (triggers browser print)
- Close (dismisses the modal)
2. Dependencies & Technologies
| Category | Details |
|---|---|
| Framework | ASP.NET Core MVC (Razor Views) |
| Front-end Library | Bootstrap 5 (Modal, Buttons) |
| PDF Embedding | <embed> HTML tag |
| Server‑side URL Helpers | @Url.Action(...) |
| Programming Language | C#, Razor syntax |
3. View Model
@model IrbyImaging.Models.DocumentImaging
- Model Type:
DocumentImaging - Key Property Used:
DocumentImageId(guid/int) – identifies the PDF to render.
Example of DocumentImaging Class Structure:
| Property Name | Type | Description |
|---|---|---|
| DocumentImageId | int | Unique ID for the document image |
| FileName | string | Name of the file (optional) |
| ContentType | string | MIME type (application/pdf) |
| ... | ... | Additional metadata |
4. Template Structure & Key Areas
<div class="modal-content" style="height: 100%;">
<!-- Header -->
<div class="modal-header">
<h5 class="modal-title" id="transaction-detailModalLabel">Document Details</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<!-- Body: PDF Preview -->
<div style="height: 600px">
<div class="modal-body" style="height: 100%;">
<embed
src="@Url.Action("RenderDeleteImagePrev", "Imaging", new { id = Model.DocumentImageId, preview = true })#zoom=FitH"
type="application/pdf"
width="100%"
height="100%" />
</div>
</div>
<!-- Footer Buttons -->
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Print Document</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
4.1 Modal Container
.modal-contentwrapper withstyle="height:100%"to ensure full-height display.
4.2 Header Section
- Title: “Document Details”
- Close Button:
- Uses
btn-closefor Bootstrap’s standard “X” data-bs-dismiss="modal"to close on click
- Uses
4.3 Body Section
- Fixed Height Wrapper: 600px container for consistent PDF viewport.
- Embed Tag:
srccalls the RenderDeleteImagePrev action on the Imaging controller#zoom=FitHfragment auto-fits width horizontallytype="application/pdf"instructs browser PDF plugin
4.4 Footer Section
| Button | Class | Action |
|---|---|---|
| Print Document 📄 | btn btn-secondary |
data-bs-dismiss="modal"¹ |
| Close ❌ | btn btn-secondary |
data-bs-dismiss="modal" |
¹ Note: You can hook a window.print() event in JavaScript when clicking “Print Document”.
5. API Endpoints Overview
While this view itself has no controller logic, it relies on:
Rendering Endpoint
| HTTP Verb | URL | Purpose |
|---|---|---|
| GET | /Imaging/RenderDeleteImagePrev?id={id}&preview=true |
Returns PDF file stream for embed tag. |
- Controller:
ImagingController - Action:
RenderDeleteImagePrev(int id, bool preview)
6. Third‑party Integrations
- Bootstrap 5 – Modal structure and buttons
- Browser PDF Viewer – Modern browsers will auto-render
<embed type="application/pdf">
7. Helper Methods / Utilities
None used directly in this view.
However, the project may have:
- Html Helpers for modals
- JavaScript Utilities for print callback
8. Error Handling & Return Types
- The view does not itself include error handling.
- Best Practices:
- Ensure
RenderDeleteImagePrevreturns404 Not FoundorFileResulton invalidid. - Provide a fallback UI (e.g., “Document not available”) if PDF fails to load.
- Ensure
9. UML Diagram
classDiagram
class deleteModal.cshtml {
+DocumentImaging Model
+Bootstrap Modal
+Embed PDF
}
class ImagingController {
+RenderDeleteImagePrev(int id, bool preview)
}
deleteModal.cshtml --> ImagingController : callsRenderDeleteImagePrev()
deleteModal.cshtml --> DocumentImaging : bindsModel()
10. Sample Code Block
<!-- Triggering Modal from Parent View -->
<button
class="btn btn-danger"
data-bs-toggle="modal"
data-bs-target="#deleteDocModal"
>
Delete / Preview Document
</button>
<!-- Modal Placeholder -->
<div class="modal fade" id="deleteDocModal" tabindex="-1">
<div class="modal-dialog modal-xl">
@Html.Partial("deleteModal", Model)
</div>
</div>
11. Usage Examples
-
Inline Partial:
@Html.Partial("deleteModal", new DocumentImaging { DocumentImageId = 42 }) -
AJAX Load (jQuery):
$('#deleteDocModal .modal-dialog').load('/Imaging/PartialDeleteModal?id=42'); $('#deleteDocModal').modal('show'); -
Print Hook (Vanilla JS):
document.querySelector('#deleteDocModal .btn-secondary:first-child') .addEventListener('click', () => window.print());
12. Conclusion
This deleteModal.cshtml razor view provides a clean, reusable Bootstrap modal to preview and potentially delete PDF documents within the IrbyImaging application.
Key takeaways:
- Simple Integration: Pulls a
DocumentImagingmodel and renders a PDF. - Extensible: Easily hook into print events or customize the footer.
- Seamless UX: Uses Bootstrap’s modal lifecycle for fast, client‑side interaction.
Feel free to extend it with additional buttons (e.g., Confirm Delete) or by handling errors gracefully in case the PDF fails to load. 🚀
Documentation generated on 📅