Skip to main content

Dashboard

Introduction

After successful login, users land on the dashboard — a module hub that displays tiles for each ERP area the user is allowed to access. The dashboard reads module boolean flags from Session["dtVerifyUser"] and exposes them to the view through ViewData keys that control tile visibility.

The dashboard does not load module-specific business data; it is a navigation shell gated by CompID.

Purpose

This page explains how the home screen works, which flags drive each tile, and how users proceed into functional modules.

When to Use

Refer to this page when you:

  • Add or hide a module tile on the home screen
  • Debug why a user does not see a expected module link
  • Trace navigation from login to first module screen
  • Extend dashboard with new summary widgets (requires controller changes)

How It Works

Request flow

DashboardController

URL: /Dashboard/Index
File: DamsyERP.UI/Controllers/DashboardController.cs

public ActionResult Index()
{
if (string.IsNullOrEmpty(Convert.ToString(Session["CompID"])))
return Redirect("~/Login/Index");

var dtVerifyUser = Session["dtVerifyUser"] as User;
if (dtVerifyUser != null)
{
ViewData["Payroll"] = dtVerifyUser.Payroll;
ViewData["Webenroll"] = dtVerifyUser.Webenroll;
ViewData["Billing"] = dtVerifyUser.Billing;
ViewData["StockModuleAccess"] = dtVerifyUser.ZSTOCK;
ViewData["ZSales"] = dtVerifyUser.ZSales;
ViewData["Ess"] = dtVerifyUser.Ess;
ViewData["ControlPanel"] = dtVerifyUser.ControlPanel;
ViewData["AttPunch"] = dtVerifyUser.AttPunch;
ViewData["Operation"] = dtVerifyUser.Operation;
ViewData["ManagementDashboard"] = dtVerifyUser.ManagementDashboard;
ViewData["ContractedRates"] = dtVerifyUser.ContractedRates;
ViewData["VerificationAndApproval"] = dtVerifyUser.VerificationAndApproval;
}

return View();
}

ViewData flag reference

ViewData keySource propertyTile label (typical)
PayrollUser.PayrollPayroll
WebenrollUser.WebenrollRegistration / Web Enroll
BillingUser.BillingBills
StockModuleAccessUser.ZSTOCKStock
ZSalesUser.ZSalesSales
EssUser.EssESS
ControlPanelUser.ControlPanelControl Panel / Administrator
AttPunchUser.AttPunchAttendance Punching
OperationUser.OperationOperation
ManagementDashboardUser.ManagementDashboardManagement Dashboard
ContractedRatesUser.ContractedRatesContracted Rates
VerificationAndApprovalUser.VerificationAndApprovalVerification & Approval
StockModuleAccess naming

The ViewData key StockModuleAccess maps to User.ZSTOCK — not ViewData["ZSTOCK"].

View behavior

Views/Dashboard/Index.cshtml (and partials) conditionally render tiles:

@if (Convert.ToBoolean(ViewData["Payroll"]))
{
<a href="@Url.Action("ModuleManagement", "Login", new { PageID = "Payroll" })">Payroll</a>
}

Each tile links to LoginController.ModuleManagement with a PageID that redirects into the correct Area dashboard. See Module Routing.

Layout and assets

The dashboard uses the root layout (Views/Shared/_Layout.cshtml) with shared shell CSS:

  • app-assets/css/shell-modern.css
  • app-assets/css/sidebar-unified.css

Unlike module pages, there is no _LayoutPayroll or module sidebar until the user enters an Area.

Developer Notes

  • No DAL on dashboard: Current implementation is flag-driven only. KPI widgets would require new DAL calls and ViewBag data.
  • Session dependency: If dtVerifyUser is null (corrupt session), no tiles render — user should re-login.
  • CompID gate: Empty CompID always redirects to login, not UserLogin action — direct ~/Login/Index.

Examples

User with Payroll + Billing only

After login, dtVerifyUser.Payroll = true, dtVerifyUser.Billing = true, all others false → dashboard shows two tiles.

Click Payroll tile
→ GET /Login/ModuleManagement?PageID=Payroll
→ Redirect /Payroll/PayrollDashboard/Index

Direct URL attempt without session

GET /Dashboard/Index without CompID
→ Redirect /Login/Index

Important Notes

Flag true ≠ full menu access

Tiles reflect module-level flags from GetLoginUser. Individual pages may still check GetDataUserPermissions for menu CRUD rights.

Dashboard is not role-specific layout

All users see the same dashboard view; differences are only which tiles appear.

Common Mistakes

MistakeResult
Setting ViewData in view instead of controllerTiles wrong on postback
Linking tile directly to Area without ModuleManagementWorks but bypasses central redirect table — inconsistent PageIDs
Expecting ViewData["ZSTOCK"]Key is StockModuleAccess
Forgetting to update dashboard when adding new moduleNew module flag exists but no tile

Next Steps

  1. Read Module Routing for the complete PageID → URL table.
  2. Enter a module and follow its Area dashboard documentation in module-specific guides (when available).