📄 UploadPnc.cshtml Documentation
Path:
IrbyImaging/Views/AccountingImaging/UploadPnc.cshtml
📑 Table of Contents
- Overview & Purpose
- File Structure
- Dependencies & Technologies
- Key Functional Areas
4.1. Page Metadata & Layout
4.2. Styles & Plugins
4.3. Upload CSV Form
4.4. Loading Overlay
4.5. JavaScript & Initialization
4.6. Dropzone Configuration (Commented) - View Models & Data Flow
- Error Handling & User Feedback
- API Endpoint Overview
- Third‑Party Integrations
- Usage Example
- Sequence UML Diagram
- Conclusion
🔍 Overview & Purpose
This Razor view is part of the AccountingImaging module and provides a user interface for:
- Uploading PNC CSV files along with specifying a Statement Month/Year.
- Displaying feedback messages and a loading spinner during upload.
- (Commented out) Preparing a Dropzone.js integration for drag‑and‑drop file uploads.
It is intended to be used by internal accounting or imaging teams to bulk-import PNC statements.
📂 File Structure
UploadPnc.cshtml
├── @{} // ViewBag & Layout definitions
├── @section styles // Stylesheet includes
├── <!-- Dropzone --> (commented-out)
├── <form> UploadCsv // Main CSV upload form
├── @if(message) // Display feedback
├── <div id="loading"> // Loading overlay
├── <style> // Inline CSS for spinner overlay
└── <script> // JS includes & inline scripts
⚙️ Dependencies & Technologies
| Library / Framework | Usage |
|---|---|
| ASP.NET MVC Razor | Server‑side templating |
| jQuery | DOM manipulation & event handling |
| Bootstrap | Responsive layout & styling |
| MetisMenu | Sidebar menu plugin |
| SimpleBar | Custom scrollbars |
| Waves.js | Ripple effect on buttons |
| Dropzone.js (v5.5.1) | (Commented) Drag‑and‑drop uploads |
| Syncfusion DatePicker | <ejs-datepicker> for Month/Year selection |
| spin.js | Loading spinner animation |
🔑 Key Functional Areas
4.1 Page Metadata & Layout
@{
ViewBag.Title = "Form File Upload";
ViewBag.pTitle = "Form File Upload";
ViewBag.pageTitle = "Forms";
Layout = "~/Views/Shared/_AccountingLayout.cshtml";
var category = ViewBag.category;
var message = ViewBag.Message;
}
- Purpose: Sets up page titles and specifies the shared layout (
_AccountingLayout.cshtml).
4.2 Styles & Plugins
@section styles {
<!-- Dropzone CSS (if enabled) -->
<link href="~/assets/libs/dropzone/min/dropzone.min.css" rel="stylesheet" />
}
- Loads Dropzone stylesheet for drag‑and‑drop area (currently not active).
4.3 Upload CSV Form
<form asp-action="UploadPncCsv" class="form-horizontal" id="csvForm" method="post" defaultbutton="searchRecords" enctype="multipart/form-data">
<div class="card">
<div class="card-body">
<h4 class="card-title mb-4">Upload Csv</h4>
<!-- Date Picker -->
<ejs-datepicker id="monthYear"
format="MMMM y"
floatLabelType="Auto"
placeholder="Statement Month Year"
width="250"
start="Year"
depth="Year">
</ejs-datepicker>
<!-- File Input -->
<div class="row mb-4">
<i class="display-5 text-muted bx bxs-cloud-upload"></i>
<label class="col-form-label col-lg-3">Browse or Drop Files to Upload...</label>
<div class="col-lg-12">
<input class="form-control" name="file" type="file" multiple />
</div>
</div>
<!-- Submit Button -->
<div class="row justify-content-end">
<div class="col-lg-12">
<button id="submitbtn" type="submit" class="btn btn-primary">Upload Csv</button>
</div>
</div>
</div>
</div>
</form>
- asp-action="UploadPncCsv" posts to the
UploadPncCsvaction in the current controller. - ejs-datepicker for month/year selection (Syncfusion).
- File input allows multiple files.
4.4 Loading Overlay
<div id="loading">
<div id="loadingcontent">
<p id="loadingspinner"><br/> Upload in progress. Please wait..... </p>
</div>
</div>
<style>
#loading { display: none; position: fixed; ... opacity: .8; }
#loadingspinner { text-align: center; font-size: larger; padding-top: 80px; }
</style>
- Hidden by default. Shown during AJAX/form submission.
- Provides user feedback with semi‑transparent overlay.
4.5 JavaScript & Initialization
-
Library Includes
<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="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.5.1/dropzone.js"></script> <script src="~/assets/js/app.js"></script> <script src="~/assets/js/spin.js"></script> -
Form Validation & Spinner
$(function() { $("#submitbtn").click(function () { $("#loading").fadeIn(); // Validation rules var options = { rules: { 'monthYear': { required: true } }, customPlacement: (input, error) => { input.parentElement.parentElement.appendChild(error); } }; var formValidator = new ej.inputs.FormValidator('#csvForm', options); if (formValidator.allowSubmit) { // Start spinner var opts = {/* spinner configuration */}; var target = document.getElementById('loading'); new Spinner(opts).spin(target); } else { $("#loading").fadeOut(); } }); });- Uses Syncfusion
FormValidatorfor client‑side validation. - Uses spin.js to show a customizable spinner.
- Uses Syncfusion
4.6 Dropzone Configuration (Commented)
Note: This section is commented-out in the HTML, but the JS remains for future use.
Dropzone.options.dropzoneForm = {
paramName: "file",
autoDiscover: false,
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 100,
init: function() {
var dz = this;
$("#uploadfile").click(() => dz.processQueue());
dz.on("complete", (file) => {
dz.removeAllFiles();
window.location.href = '@Url.Action("DocPreview","Imaging")?fileName=' + file.name;
});
}
};
- Auto‑process disabled; triggered manually by
#uploadfilebutton. - On completion, navigates to a document preview.
🤝 View Models & Data Flow
- Model: No strongly-typed model; uses
ViewBagfor:ViewBag.categoryViewBag.Message
- Form Fields:
monthYear(string, “MMMM yyyy” format)file(IFormFileCollection)
⚠️ Error Handling & User Feedback
- Client-Side Validation: Syncfusion
FormValidatorensuresmonthYearis provided. - Server Feedback:
Displays any message set by the controller via@if (!string.IsNullOrEmpty(message)) { <h2>@message</h2> }ViewBag.Message.
🔗 API Endpoint Overview
| HTTP Method | Route | Purpose |
|---|---|---|
| POST | /AccountingImaging/UploadPncCsv | Processes uploaded CSV files |
Note: Actual route may vary based on controller naming conventions.
🔌 Third‑Party Integrations
- Syncfusion DatePicker (
<ejs-datepicker>) - Dropzone.js (drag & drop uploads)
- spin.js (loading spinner)
- jQuery, Bootstrap, MetisMenu, SimpleBar, Waves.js
🚀 Usage Example
-
Navigate to the PNC upload page:
https://<host>/AccountingImaging/UploadPnc -
Select the Statement Month/Year via the date picker.
-
Browse or Drag one or more CSV files into the file input.
-
Click Upload Csv.
-
Observe the spinner overlay indicating progress.
-
Review success or error message on completion.
📊 Sequence UML Diagram
sequenceDiagram
participant U as User
participant B as Browser
participant S as Server
U->>B: GET /UploadPnc
B->>S: Render View
S->>B: HTML + JS
B->>U: Display Form
U->>B: Fill MonthYear & Files
U->>B: Click Upload
B->>S: POST /UploadPncCsv
S->>S: Validate & Process CSV
alt Success
S->>B: Return Success Message / Redirect
else Failure
S->>B: Return View with Error
end
B->>U: Display Result
📝 Conclusion
UploadPnc.cshtml is a versatile Razor view tailored for PNC CSV ingestion by accounting teams. It combines Syncfusion UI elements, robust client‑side validation, and visual feedback mechanisms (loading overlay & spinner). The commented Dropzone integration hints at future drag‑and‑drop enhancements. Developers can customize styles, extend the JS logic, or hook into additional server‑side processing in the UploadPncCsv action to meet evolving business needs.