📄 IrbyImaging/Views/Billing/Index.cshtml Documentation
📑 Table of Contents
- Overview & Purpose
- File & Location
- Model & Data Context
- Layout & ViewBag Configuration
- Styles & CSS Dependencies
- Markup & Form Structure
6.1 Carrier Selection
6.2 Invoice Month & Year
6.3 File Upload Input
6.4 Submit Button - Loading Spinner Overlay
- Scripts & JavaScript
8.1 Core Libraries
8.2 Dropzone Configuration
8.3 Spin.js Spinner - Dependencies & Technologies
- UML Sequence Diagram
- Usage Example
- Conclusion
1. Overview & Purpose 🚀
Index.cshtml is an ASP.NET MVC Razor View responsible for rendering the Billing File Upload page.
It allows users to:
- Select an invoice carrier, month, and year
- Browse or drag & drop files
- Monitor upload progress via a spinner overlay
This View posts data to the Upload action in the BillingController, where the server processes the file.
2. File & Location 📂
IrbyImaging
└── Views
└── Billing
└── Index.cshtml
3. Model & Data Context 📝
@model IrbyImaging.UI.Models.Billing
- Model:
IrbyImaging.UI.Models.Billing - Key Properties (inferred):
Property Type Description CarrierId int Selected carrier ID Carrier IEnumerable List of carriers for <select>InvoiceMonth Month (enum) Selected invoice month InvoiceYear int Selected invoice year CarriersTypeDetail IEnumerable Raw carrier data, used internally
4. Layout & ViewBag Configuration ⚙️
@{
ViewBag.Title = "Billing File Upload";
ViewBag.pTitle = "Billing File Upload";
ViewBag.pageTitle = "Billing";
Layout = "~/Views/Shared/_ATSLayout.cshtml";
}
- Layout: Shared
_ATSLayout.cshtml - ViewBag keys set page titles for breadcrumb, header, HTML
<title>, etc.
5. Styles & CSS Dependencies 🎨
@section styles {
<!-- Plugins css -->
<link href="~/assets/libs/dropzone/min/dropzone.min.css" rel="stylesheet" />
}
- Dropzone CSS for drag‑&‑drop file area (optional in this view)
6. Markup & Form Structure 🏗️
The form wraps inputs and posts to the BillingController’s Upload action with multipart/form-data.
@using (Html.BeginForm("Upload", "Billing", FormMethod.Post,
new { enctype = "multipart/form-data" })) {
<!-- form contents -->
}
6.1 Carrier Selection 🏷️
<label asp-for="CarrierId">Invoice Carrier</label>
<select asp-for="CarrierId" asp-items="@Model.Carrier"
class="form-control"></select>
<span asp-validation-for="CarrierId" class="text-danger"></span>
asp-for="CarrierId"binds toModel.CarrierIdasp-itemsusesModel.Carrierto populate options
6.2 Invoice Month & Year 📅
<label asp-for="InvoiceMonth">Invoice Month</label>
<select asp-for="InvoiceMonth"
asp-items="@Html.GetEnumSelectList<Month>()"></select>
<span asp-validation-for="InvoiceMonth"></span>
<label asp-for="InvoiceYear">Invoice Year</label>
<input asp-for="InvoiceYear" class="form-control" />
<span asp-validation-for="InvoiceYear"></span>
- Month bound to an enum via
GetEnumSelectList<Month>() - Year taken as plain integer input
6.3 File Upload Input 💾
<label>Browse or Drop Files to Upload...</label>
<input type="file" name="file" class="form-control"
style="height:100px" />
- Simple
<input type="file">to choose or drag & drop - Note: Dropzone is loaded but not bound to this
<input>
6.4 Submit Button 🖱️
<button id="submitbtn" type="submit" class="btn btn-primary">
Upload
</button>
7. Loading Spinner Overlay ⏳
<div id="loading">
<div id="loadingcontent">
<p id="loadingspinner">
Upload in progress. Please wait.....
</p>
</div>
</div>
<style>
/* Styling to center overlay text */
</style>
- Hidden by default (
display: none;) - Fades in on form submission
- Spinner created via spin.js
8. Scripts & JavaScript 📜
8.1 Core Libraries
<script src="~/assets/libs/jquery/jquery.min.js"></script>
<script src="~/assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="~/assets/libs/metismenu/metisMenu.min.js"></script>
<script src="~/assets/libs/simplebar/simplebar.min.js"></script>
<script src="~/assets/libs/node-waves/waves.min.js"></script>
<script src="~/assets/js/app.js"></script>
- jQuery, Bootstrap, and UI utilities for layout & animations.
8.2 Dropzone Configuration 📦
<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/dropzone.js"></script>
<script>
Dropzone.options.dropzoneForm = {
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 100,
init: function () {
var dz = this;
$("#uploadfile").click(function () {
dz.processQueue();
});
dz.on("complete", function(file) {
dz.removeAllFiles();
window.location.href = '@Url.Action("DocPreview","Imaging")?fileName=' + file.name;
});
},
accept: function (file, done) { done(); }
};
</script>
- Note: The Dropzone form (
dropzoneForm) is defined but not wired to any<form>in this view out‑of‑the‑box. - Handles multiple file uploads and redirects on completion.
8.3 Spin.js Spinner 🔄
<script src="~/assets/js/spin.js"></script>
<script>
$(function () {
$("#submitbtn").click(function () {
$("#loading").fadeIn();
var opts = { /* spinner options */ };
var target = document.getElementById('loading');
new Spinner(opts).spin(target);
});
});
</script>
- On Upload click, spinner fades in and animates using
spin.js.
9. Dependencies & Technologies 🧩
| Category | Libraries / Tools |
|---|---|
| Front-end CSS | Bootstrap, Dropzone (CSS) |
| Front-end JS | jQuery, Bootstrap JS, MetisMenu, SimpleBar, Waves, Dropzone, spin.js |
| Server-side | ASP.NET MVC / Razor |
| Layout | _ATSLayout.cshtml |
| Data Binding | Tag Helpers (asp-for, asp-items), HTML Helpers (Html.BeginForm) |
10. UML Sequence Diagram 📈
sequenceDiagram
participant U as User
participant B as Browser
participant V as Index.cshtml
participant C as BillingController
participant S as Server
U->>B: Clicks GET /Billing/Index
B->>C: HTTP GET
C->>V: Render view with Model
V->>U: Display form
U->>V: Fills form & clicks <Upload>
V->>B: Form POST /Billing/Upload
B->>C: HTTP POST + file
C->>S: Save & process file
S-->>C: Success
C-->>B: Redirect/JSON
B-->>U: Show confirmation
11. Usage Example 🛠️
- Navigate to
/Billing/Index - Select:
- Carrier from dropdown
- Month (e.g., January)
- Year (e.g., 2024)
- Browse or drag & drop your invoice file
- Click Upload
- Watch spinner overlay until upload completes
On success, you may be redirected to a document preview page.
12. Conclusion ✅
This Index.cshtml Razor View provides a user‑friendly interface for uploading billing invoices.
Key features include:
- Strongly‑typed data binding via Tag Helpers
- Enum support for month selection
- File upload with progress indication
- Modular JavaScript for Dropzone and spinner
Use this page as a template for any file‑upload scenario in your ASP.NET MVC applications. 🚀