๐Ÿ“„ Documentation: IrbyImaging/Views/GLType/Index.cshtml

File Path: IrbyImaging/Views/GLType/Index.cshtml
Purpose: Razor view for listing and managing General Ledger (GL) records via DataTables.


๐Ÿ“‘ Table of Contents

  1. Overview & Purpose
  2. Key Functional Areas
  3. Dependencies & Technologies
  4. ViewModel & DataModel
  5. UI Elements & Layout
  6. Action Links & Routing
  7. Thirdโ€‘party Integrations
  8. Sample Code Blocks
  9. Usage Examples
  10. UML Diagram (Simplified)
  11. Conclusion

๐Ÿ” Overview & Purpose

This Razor view renders a paginated, searchable, and exportable table of General Ledger (GL) records (often called โ€œGL/TAPโ€ in this context). It allows users to:

  • View all existing GL records
  • See the total count of records
  • Add, Update, or Delete individual records
  • Export the table to CSV, Excel, or print directly

It is intended to be a part of an ASP.NET Core MVC application under the IrbyImaging solution.


๐Ÿ› ๏ธ Key Functional Areas

  1. Page Setup

    • Sets the title: "General Ledger List"
    • Applies a shared layout: ~/Views/Shared/_ATSLayout.cshtml
  2. Header & Counters

    • Title <h2> with a dynamic badge showing record count
    • โ€œAdd New GL Recordโ€ button
  3. Data Table

    • Uses <table> with id assetDatatable
    • Columns:
      Column Purpose
      GL Code Unique code of the GL entry
      Description Textual description of the GL entry
      Available? Indicates if the record is active
      Update Link to Edit the record
      Delete Link to Delete (soft or hard) record
  4. DataTables Initialization

    • Integrates with DataTables.js
    • Exposes CSV, Excel, and Print export buttons

๐Ÿ”Œ Dependencies & Technologies

Type Library / Framework
Server-side ASP.NET Core MVC
View Engine Razor (.cshtml)
CSS Framework Bootstrap 4
Table Plugin DataTables (v1.10.25)
JS Export Extensions DataTables Buttons, JSZip, PDFMake
CDN & Local Assets Mix of ~/lib/datatables/* and public CDNs

๐Ÿ—‚๏ธ ViewModel & DataModel

  • Model Declaration
    @model IrbyImaging.DomainClasses.GeneralLedger
    
  • Core Properties
    public class GeneralLedger {
        public IEnumerable<GLTypeDetail> GLTypeDetail { get; set; }
    }
    
    public class GLTypeDetail {
        public int Id { get; set; }
        public string Code { get; set; }
        public string Description { get; set; }
        public bool IsInactive { get; set; }
    }
    

๐ŸŽจ UI Elements & Layout

  1. Header Section

    <h2>GL/TAP Records 
      <span class="badge irby-red">@Model.GLTypeDetail.Count()</span>
    </h2>
    <p>
      <a asp-action="Create" class="btn-sm btn-success irby-green">
        Add New GL Record
      </a>
    </p>
    
  2. Data Table Markup

    <table id="assetDatatable" class="table table-striped ...">
      <thead> ... </thead>
      <tbody>
        @foreach (var item in Model.GLTypeDetail) {
          <tr>
            <td>@item.Code</td>
            <td>@item.Description</td>
            <td>@(item.IsInactive ? "โœ…" : "โŒ")</td>
            <td>
              <a href="@Url.Action("Edit","GLType",new { id=item.Id })"
                 class="btn-sm btn-warning">Update</a>
            </td>
            <td>
              <a href="@Url.Action("Delete","GLType",new { id=item.Id })"
                 class="btn-sm btn-danger">Delete</a>
            </td>
          </tr>
        }
      </tbody>
    </table>
    

Button / Link Action Controller Route Values CSS Classes
Add New GL Record Create GLType None btn-success
Update Edit GLType id = item.Id btn-warning
Delete Delete GLType id = item.Id btn-danger

Note: The Delete link currently points to the Edit action in code. Confirm if this is intentional or should be updated to a Delete action.


๐ŸŒ Thirdโ€‘party Integrations

  • DataTables Core
    • Display, pagination, sorting
  • Buttons Extension
    • Export to CSV, Excel, Print
  • JSZip & PDFMake
    • Excel file generation
    • PDF font support

CDN scripts loaded under @section Scripts:

<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.7.1/js/dataTables.buttons.min.js"></script>
<!-- ... jszip, pdfmake, buttons.html5, buttons.print ... -->

๐Ÿ“‹ Sample Code Blocks

DataTable Initialization

$(document).ready(function () {
  $('#assetDatatable').DataTable({
    dom: 'Bfrtip',
    buttons: [ 'csv', 'excel', 'print' ]
  });
});

Conditional Icon Rendering

<td>
  @(item.IsInactive 
     ? "โœ…"     // Active
     : "โŒ")    // Inactive
</td>

๐Ÿš€ Usage Examples

  1. Navigating to the GL List

    • URL: /GLType/Index
    • Displays table with all GL records.
  2. Exporting Data

    • Click CSV button in top-left of table.
    • File downloaded: GLTypeDetail.csv.
  3. Adding a New Record

    • Click Add New GL Record.
    • Redirects to /GLType/Create.
  4. Editing an Existing Record

    • Click Update icon on a row.
    • Redirects to /GLType/Edit/{id}.

๐Ÿ› ๏ธ UML Diagram (Simplified)

@startuml
class GeneralLedger {
  +IEnumerable<GLTypeDetail> GLTypeDetail
}

class GLTypeDetail {
  +int Id
  +string Code
  +string Description
  +bool IsInactive
}

GeneralLedger "1" *-- "*" GLTypeDetail
@enduml

UML Diagram- Simplified class relationship.


โœ… Conclusion

This view delivers a rich, interactive experience for managing General Ledger records through:

  • Interactive table with filtering, sorting, paging
  • Action buttons for CRUD operations
  • Seamless data exports (CSV, Excel, Print)

By leveraging ASP.NET Core MVC with Razor and the powerful DataTables plugin, the page ensures maintainability, scalability, and a userโ€‘friendly interface. ๐ŸŽ‰


End of documentation.