Factory App Navigation
The Home/Dashboard page serves as the primary landing page and navigation hub for the Shelter Enterprises application. This page displays a role-based menu system where users can access different production processes, specialized products, and utility functions based on their assigned user groups and permissions.
The interface is organized into three main sections:
- Production Processes (Blue section) - Core factory operations including inventory management, pre-expansion, molding, and cutting lines
- Specialized Products (Green section) - Specialty product lines such as EIFS, Robo Pack, Pool Steps, Shape Mold, Pre-Puff, and Sill Seal
- Utilities (Teal section) - Cross-functional tools like Export Jobs and Print Labels
Each button represents either a production station, a tool set, or an information display. Buttons are dynamically shown or hidden based on the user's group memberships, ensuring users only see the functions they are authorized to access.
![INSERT SCREENSHOT HERE: Full view of the Home/Dashboard page showing all three sections (Production Processes, Specialized Products, and Utilities) with all buttons visible. This represents an admin user's view with full access.]
2. Front-End Behavior
Page Layout
The page uses a responsive Bootstrap-based layout with the following structure:
Header Section:
- Application title: "Shelter Enterprises"
- Subtitle: "Select a process to begin"
- User badge displaying the logged-in user's first and last name
- Action buttons:
- View Inventory (Blue, available to all users) - Links to
/inventory/view_inventory - Admin Tools (Yellow, admin only) - Links to
/admin/view(visible only if user has admin permissions) - Log Out (Gray) - Links to
/logout
- View Inventory (Blue, available to all users) - Links to
![INSERT SCREENSHOT HERE: Close-up of the header section showing the user badge and the three action buttons (View Inventory, Admin Tools, Log Out).]
Section Cards
Production Processes Card (Blue Header)
- Contains up to 4 process buttons arranged in a 2-column grid:
- Add Inventory - Visible to users in
addinventory,admin, orfactory_admingroups - Pre-Expansion - Visible to users in
preexpand,admin, orfactory_admingroups - Mold - Visible to users in
mold,admin, orfactory_admingroups - Lines 1 & 2 - Visible to users in
lines,admin, orfactory_admingroups
- Add Inventory - Visible to users in
Specialized Products Card (Green Header)
- Contains up to 6 specialty product buttons arranged in a 2-column grid:
- EIFS - Visible to users in
eifs,admin, orfactory_admingroups - Robo Pack - Visible to users in
eifs,admin, orfactory_admingroups (shares EIFS permission) - Pool Steps - Visible to users in
step,admin, orfactory_admingroups - Shape Mold - Visible to users in
shape_mold,admin, orfactory_admingroups - Pre-Puff - Visible to users in
prepuff,admin, orfactory_admingroups - Sill Seal - Visible to users in
sill_seal,admin, orfactory_admingroups
- EIFS - Visible to users in
Utilities Card (Teal Header)
- Contains utility functions arranged in a 3-column grid:
- Export Jobs - Available to all authenticated users, links to
/user/view_jobs - Print Labels - Visible to users in
lines,admin, orfactory_admingroups, links to/eifs/full_line_labels
- Export Jobs - Available to all authenticated users, links to
Responsive Design
The page includes custom CSS for responsive behavior:
- Mobile devices (< 768px): Buttons stack vertically, reduced padding, smaller font sizes
- Small devices (< 576px): Further reduced spacing and font sizes for optimal mobile viewing
- Hover effects: Buttons feature a subtle lift animation (
translateY(-3px)) and shadow on hover
Icons
Each button includes a Font Awesome icon to visually represent its function:
- Add Inventory:
fa-plus-circle - Pre-Expansion:
fa-expand - Mold:
fa-cube - Lines 1 & 2:
fa-stream - EIFS:
fa-building - Robo Pack:
fa-robot - Pool Steps:
fa-shoe-prints - Shape Mold:
fa-shapes - Pre-Puff:
fa-box - Sill Seal:
fa-tape - Export Jobs:
fa-file-export - Print Labels:
fa-tags
![INSERT SCREENSHOT HERE: Example of a limited user view showing only 2-3 buttons that match their specific role permissions (e.g., a user only in the "lines" group seeing Lines 1 & 2, Export Jobs, and Print Labels).]
3. Back-End Logic
Controller: User::view()
File Location: src/app/Controllers/User.php
The view() method in the User controller handles the display of the home page:
public function view(): string|RedirectResponse
{
$data = get_user_permissions();
$title['title'] = "Home";
$user = auth()->getUser();
if ($user->username === 'suser') {
// If user is the summary user logout and kick them back to the login page
auth()->logout();
return redirect('login');
} else {
$data['user'] = auth()->user();
return view('templates/header', $title)
. view('home', $data)
. view('templates/footer');
}
}
Key Logic:
- Retrieves user permissions via the
get_user_permissions()helper function - Checks if the user is the special 'suser' (summary user) account - if so, logs them out
- Sets the page title to "Home"
- Passes the current user object and permissions to the view
- Renders the page using three view components: header, home content, and footer
Route: /user/view
Helper Function: get_user_permissions()
File Location: src/app/Helpers/user_helper.php
This helper function determines which sections of the home page should be visible based on the authenticated user's group memberships:
function get_user_permissions(): array
{
$user = auth()->user();
// Initialize all permissions as 'none' (hidden)
$data['preexp'] = 'none';
$data['lines'] = 'none';
$data['eifs'] = 'none';
$data['addinv'] = 'none';
$data['mold'] = 'none';
$data['prepuff'] = 'none';
$data['sill_seal'] = 'none';
$data['step'] = 'none';
$data['shape_mold'] = 'none';
$data['admin_tools'] = 'none';
// Check user group memberships and set to 'block' (visible) if authorized
if ($user !== null) {
if ($user->inGroup("admin", "factory_admin")) {
$data['admin_tools'] = 'block';
}
if ($user->inGroup("preexpand", "admin", "factory_admin")) {
$data['preexp'] = 'block';
}
// ... additional group checks for each section
}
return $data;
}
Return Value: An associative array where keys are section identifiers and values are CSS display properties ('none' or 'block')
Authentication Flow
- User accesses
/user/view(or is redirected after login) Login::view()checks if user is authenticated- If authenticated and not admin: redirects to
/user/view - If authenticated and admin: redirects to
/admin/view User::view()retrieves permissions and renders the home page
View File
File Location: src/app/Views/home.php
The view file uses PHP conditional statements to show/hide buttons based on the permissions array:
<?php if (isset($addinv) && $addinv === 'block'): ?>
<div class="col-md-6 mb-3">
<a class="btn btn-outline-primary btn-block h-100" href="/inventory/add_view">
<i class="fas fa-plus-circle mb-2 d-block" style="font-size: 1.5rem;"></i>
Add Inventory
</a>
</div>
<?php endif; ?>
4. Developer Notes
Permission System
The application uses a group-based permission system implemented through CodeIgniter Shield. Each user can belong to one or more groups, and page visibility is controlled by checking group membership.
Available User Groups:
admin- Full administrative access to all functionsfactory_admin- Factory-level administrative access (similar to admin)addinventory- Permission to add raw materialspreexpand- Access to pre-expansion machine datamold- Access to mold machine data and block correctionslines- Access to Lines 1 & 2 cutting operationseifs- Access to EIFS cutting and Robo Pack operationsstep- Access to Pool Steps productionprepuff- Access to Pre-Puff bag creationsill_seal- Access to Sill Seal boxing and unwindingshape_mold- Access to Shape Mold operationsshipping- Access to shipping functions (not visible on home page)maintenance- Access to maintenance functions (not visible on home page)
Adding New Buttons
To add a new button to the home page:
-
Update
get_user_permissions()helper (src/app/Helpers/user_helper.php):$data['new_section'] = 'none';
if ($user->inGroup('new_group', 'admin', 'factory_admin')) {
$data['new_section'] = 'block';
} -
Add button to view (
src/app/Views/home.php):<?php if (isset($new_section) && $new_section === 'block'): ?>
<div class="col-md-6 mb-3">
<a class="btn btn-outline-primary btn-block h-100" href="/new_section/view">
<i class="fas fa-icon-name mb-2 d-block" style="font-size: 1.5rem;"></i>
New Section Name
</a>
</div>
<?php endif; ?> -
Create corresponding user group in the database or through Shield's group management
Special User Account: 'suser'
The system includes a special "summary user" account (username: 'suser') that is automatically logged out when accessing the home page. This account is used for specific system functions and should not have access to the main navigation interface.
Session Management
- User sessions are managed through CodeIgniter Shield
- The
auth()helper provides access to authentication services - Login redirects can be stored in session flashdata (
redirect_url) to return users to their intended destination after authentication
View Inventory Button
Unlike other buttons, "View Inventory" is available to ALL authenticated users regardless of their group membership. This allows any staff member to check current inventory levels without requiring special permissions.
5. Example Usage
Example 1: Admin User Login
- Admin user logs in at
/login - System authenticates credentials via
Login::auth() - User is redirected to
/admin/view(admin panel) OR/user/viewbased on preferences - If navigating to
/user/view, all buttons are visible (admin has access to all groups) - User clicks "Mold" button
- System navigates to
/mold/viewto begin tracking mold operations
Example 2: Lines Operator Login
- Lines operator logs in at
/login - System authenticates credentials
- User is redirected to
/user/view - Home page displays:
- View Inventory button (available to all)
- Lines 1 & 2 button (visible due to 'lines' group membership)
- Export Jobs utility (available to all)
- Print Labels utility (visible due to 'lines' group membership)
- User clicks "Lines 1 & 2" to access cutting operations
Example 3: Multi-Role User
- User with memberships in
eifs,step, andprepuffgroups logs in - Home page displays:
- Production Processes section: empty (not in inventory/preexpand/mold/lines groups)
- Specialized Products section: EIFS, Robo Pack, Pool Steps, Pre-Puff buttons
- Utilities section: Export Jobs
- User can navigate to any of their authorized sections
Example 4: Kiosk Login
The application supports kiosk-style logins via URL parameters:
/login/kiosk/{username}/{password}/{redirect_path}
Example: /login/kiosk/lineuser/password123/line-view
- System authenticates the user
- Redirects to the specified path (with '-' converted to '/')
- This allows dedicated workstations to auto-login specific users
6. Related Documentation
The Home/Dashboard page links to the following sub-sections. Please refer to their individual documentation pages for detailed information:
Production Processes
- Add Inventory - Add raw material (beads, bags, boxes, filler, stickers) to the application
- Pre-Expansion - View import of lots through the Pre-Expansion machine
- Mold - View import of block data from mold machine and manually update incorrect block values
- Lines 1 & 2 - Cut blocks in inventory into finished products
Specialized Products
- EIFS - Cut blocks in inventory into EIFS blocks for insulation systems
- Robo Pack - Automated bagging system for EIFS bags with label printing
- Pool Steps - Production station for pool step manufacturing
- Shape Mold - Specialty mold operations for custom shapes
- Pre-Puff - Create Pre-Puff bags for expanded polystyrene
- Sill Seal - Create Sill Seal boxes and unwind master rolls
Utilities
- Export Jobs - Export all completed jobs from the database for reporting
- Print Line Labels - Print labels for EIFS, Lines, and Shape Mold products
- View Inventory - View current inventory levels for all materials and products
Administrative Functions
- Admin Tools - User management, system configuration, and administrative functions (admin only)
Document Version: 1.0 Last Updated: 2025-10-25 Maintained By: Development Team