The "Roles and Permissions" section allows administrators to create roles, define permissions, and assign these permissions to roles and individual users. Below are the details and functionalities available in this section.
Create Role
To create a new role:
Enter the role name in the provided input field.
Click the "Create Role" button to save the new role. This option is only available if you have the 'Write Admin' permission.
Create Permission
To create a new permission:
Enter the permission name in the provided input field.
Provide a description for the permission.
Click the "Create Permission" button to save the new permission. This option is only available if you have the 'Write Admin' permission.
Here is a list of the built-in permissions currently in the system:
'Write Admin', 'Can Read/Write to all forms'
'Manage Roles', 'Manage Roles for the application'
'Manage Jobs', 'Manage Jobs for the application'
'Create Clients', 'Create Clients for the application'
'View Client List', 'View Client List of clients in application'
'View My Jobs', 'Can Use View My Jobs page'
'View All Jobs', 'Can Use All Jobs page / Reassign Jobs'
'Assign Jobs', 'Can Create Jobs and Assign to Client'
'Admin Panel', 'Grant access to the Admin Panel will still run permission checks on all inputs'
'Create Account', 'Create Account to the application'
'Delete Account', 'Delete Account to the application'
'View Client', 'View Client page'
'Notice & Groups Management', 'View/Edit Notice & Groups Management'
'Task Status Changes', 'View all Status Changes Disables Single Task Mode'
'Custom Field Management', 'Gives access to Custom Field Management'
'Client Type Management', 'Gives access to Client Type Management'
'Reports', 'View and export Reports'
Creating a Custom Permission is easy. Just add a permission Name and a basic Description. It is simple to implement into the system. Here are a basic example:
<?php if (userHasPermission($pdo, $_SESSION['user_id'], 'Task Status Changes')): ?>
<input type="submit" name="jobComplete" value="Job Complete">
<?php endif; ?>
Assign Permissions to Roles
To assign permissions to roles:
Select a role from the list of roles displayed as fieldsets.
For each role, check the boxes corresponding to the permissions you want to assign.
Click the "Update Role Permissions" button to save the changes. This option is only available if you have the 'Write Admin' permission.
Assign Permissions to Users
To assign permissions to individual users:
Select a user from the list of users displayed as fieldsets.
For each user, check the boxes corresponding to the permissions you want to assign.
Click the "Update User Permissions" button to save the changes. This option is only available if you have the 'Write Admin' permission.
Permissions Required
Access to create and assign roles and permissions is restricted based on user permissions. The required permission for these actions is 'Write Admin'.
Manage Jobs
Managing jobs involves creating job types, tasks, and task status changes. Each of these elements is integral to organizing and tracking jobs within the system. Below are the steps and permissions required for each operation.
Create Job Type
To create a new job type, follow these steps:
Enter the job type name in the provided input field.
Click the "Create" button to save the new job type. Note that this option is only available if you have the 'Write Admin' permission.
Manage Job Types
To manage existing job types, you can select the job types you want to remove:
Check the checkboxes next to the job types you want to remove.
Click the "Remove Selected" button. Note that this option is only available if you have the 'Write Admin' permission.
Create Task
To create a new task for a job type, follow these steps:
Enter the task name in the provided input field.
Select the job types to which this task will be associated.
Click the "Create" button to save the new task. Note that this option is only available if you have the 'Write Admin' permission.
Manage Tasks
To manage existing tasks, you can select the tasks you want to remove:
Check the checkboxes next to the tasks you want to remove.
Click the "Remove Selected" button. Note that this option is only available if you have the 'Write Admin' permission.
Create Task Status Change
To create a new task status change, follow these steps:
Enter the status change name in the provided input field.
Select the tasks to which this status change will be associated.
Click the "Create Task Status Change" button to save the new status change. Note that this option is only available if you have the 'Write Admin' permission.
Manage Task Status Changes
To manage existing task status changes, you can select the status changes you want to remove:
Check the checkboxes next to the status changes you want to remove.
Click the "Remove Selected Status Changes" button. Note that this option is only available if you have the 'Write Admin' permission.
Job Details Page (job_details.php)
The job_details.php page is responsible for displaying and managing the details of a specific job in the work order system.
Core Functionalities
User Authentication: Ensures only logged-in users can access job details.
Job Information Retrieval: Fetches job details, client information, and custom fields.
Status Updates & Task Tracking: Allows updating job status and tracking task completion.
Work Order Notes Management: Supports adding and deleting notes related to the job.
Job Site Image Handling: Enables image uploads and displays job site images.
Twilio SMS Notifications: Sends automated SMS updates for task status changes.
Job Deletion: Allows admins to delete jobs along with all related data.
Database Tables Involved
Jobs - Stores job details, status, and descriptions.
ClientWorkOrders - Links jobs to clients.
WorkOrderNotes - Stores job-related notes.
JobSiteImages - Stores images uploaded for job sites.
TaskStatusChanges - Tracks task progress.
Security Considerations
Restricts access to authorized users only.
Uses prepared statements to prevent SQL injection.
Limits file upload size to avoid misuse.
Clients
Create Clients
To create a new client in the system, follow these steps:
Select the client type from the dropdown menu. The available client types are dynamically fetched from the server.
Based on the selected client type, additional fields will appear. Fill out these fields as required. The fields are dynamically generated based on the client type and can include text inputs, numbers, dates, checkboxes, and more.
If an address field is present, you can use the Google Places Autocomplete to help fill it out. This feature will also display the client's location on a map.
Click the "Create Client" button to save the new client to the database.
The form is submitted to a server-side script (`Private Files/save_client.php`) that handles saving the client details.
Master Client List
The Master Client List allows you to view and search for clients within the system. Follow these steps to use this feature:
Use the search bar at the top to filter clients by their names or other details. As you type, the list of clients will dynamically update to show only those that match your search query.
Select the client type from the dropdown menu to filter the list further. The available client types are fetched from the server and will populate the dropdown dynamically.
The client table below will display a list of clients based on the selected client type and the search query. The table columns and rows are generated dynamically to reflect the client data.
You can view, manage work orders, or delete a client using the action buttons provided for each client in the list.
The form provides a user-friendly way to navigate and manage client information, ensuring that you can quickly find and review client details as needed.
View Client
The "View Client" section allows users to view and update client information based on their client type and ID. Below are the details and functionalities available in this section.
Client Information
Displays detailed information about the client, including:
Client Name: The name of the client.
Client Details: Various fields such as address, phone number, email, etc., dynamically populated based on the client type.
Update Client Information
Allows users to update the client's information:
Each field is displayed with its current value.
The user can update the values of the fields and submit the form to save the changes.
Location on Map
The client information includes an address, the address is used to display the location on a Google Map:
The map is centered at the client's address.
A marker is placed at the client's address.
Permissions
Access to this section is restricted based on user permissions. The required permissions include:
View Client: Allows the user to view client information.
Write Admin: Allows the user to update client information.
Steps to View Client Information
Select the client type from the dropdown menu in Master Client List
Search for the Client
Click the "View Client" button to display the client's information.
Steps to Update Client Information
Modify the values of the fields as needed.
Click the "Update Client" button to save the changes.
Client Dashboard
This section provides an overview and details on managing the client dashboard functionalities.
Overview of the client dashboard
Managing client interactions and services
Monitoring client activities and updates
Customer Registration
This section guides users through the customer registration process, including validation and data handling.
Step-by-step guide for customer registration
Validating customer information
Saving and managing customer profiles
Account Management
Create Account
To create a new user account, follow these steps:
Fill in the required fields, including Username, Password, Verify Password, Full Name, and Email Address.
Select a role for the user from the dropdown menu. The roles available are fetched from the server and will populate the dropdown dynamically.
Click the "Create Account" button to save the new user account. Note that this option is only available if you have the 'Write Admin' permission.
Delete User Account
To delete an existing user account, follow these steps:
Select the user you want to delete from the dropdown menu. The list of users is fetched from the server and will populate the dropdown dynamically.
Click the "Delete User" button to remove the selected user account. Note that this action is irreversible and should be performed with caution.
Notice & Groups Management
This section allows you to create and manage notice types, assign status changes to notices, create and manage work order groups, and assign/remove users and notices to/from groups.
Create Notice Type
To create a new notice type:
Enter the notice type in the provided input field.
Click the "Create Notice" button to save the new notice type. This option is only available if you have the 'Write Admin' permission.
Delete Notice Types
To delete existing notice types:
Select the notice types you want to delete by checking the corresponding checkboxes.
Click the "Delete Selected Notice Types" button to remove them from the system.
Assign Status Changes to Notice Type
To assign status changes to a notice type:
Select the notice type from the dropdown menu.
Select the status changes to assign to the notice type from the multi-select dropdown.
Click the "Assign Status to Notice Type" button to save the assignments.
Remove Status Changes from Notice Type
To remove status changes from a notice type:
Select the notice type from the dropdown menu. The associated status changes will be loaded dynamically.
Select the status changes you want to remove by checking the corresponding checkboxes.
Click the "Remove Selected Status Changes" button to remove them from the notice type.
Create WorkOrder Group
To create a new work order group:
Enter the group name in the provided input field.
Click the "Create Group" button to save the new group.
Delete WorkOrder Group
To delete an existing work order group:
Select the group you want to delete from the dropdown menu.
Click the "Delete WorkOrder Group" button. Note that this action cannot be undone and will permanently remove the group.
Add Users to Group
To add users to a group:
Select the group from the dropdown menu.
Select the users you want to add to the group from the multi-select dropdown.
Click the "Assign Users to Group" button to save the assignments.
Remove Users from Group
To remove users from a group:
Select the group from the dropdown menu. The associated users will be loaded dynamically.
Select the users you want to remove by checking the corresponding checkboxes.
Click the "Remove Selected Users" button to save the changes.
Add Notice Types to Group
To add notice types to a group:
Select the notice type from the dropdown menu.
Select the groups to which you want to assign the notice type from the multi-select dropdown.
Click the "Assign Notice to Groups" button to save the assignments.
Remove Notice Types from Group
To remove notice types from a group:
Select the group from the dropdown menu. The associated notice types will be loaded dynamically.
Select the notice types you want to remove by checking the corresponding checkboxes.
Click the "Remove Selected Notice Types" button to save the changes.
Assign Custom Message to Status Change for Twilio
To assign a custom message to a status change for Twilio:
Select the notice type from the dropdown menu.
Select the corresponding status change from the dropdown menu.
Enter the custom message in the provided text area.
Click the "Assign Custom Message" button to save the message.
Remove Assigned Messages
To remove a previously assigned message from a status change:
Select the notice type from the dropdown menu. The associated assigned messages will be loaded dynamically.
Select the assigned message you want to remove from the dropdown menu.
Click the "Remove Assigned Message" button to delete the message.
Custom Field Management
This section allows administrators to create, update, and delete custom fields for different job types. Custom fields help in adding specific attributes to job types, enhancing the ability to manage job-related data effectively.
Add Custom Field
To add a new custom field for a job type:
Select the job type from the dropdown menu.
Enter the field title in the provided input field.
Select the field type (e.g., Text, Checkbox, Dropdown).
If the field type is a dropdown, provide the options as a comma-separated list in the options field.
Enter a description for the field (optional).
Click the "Add Custom Field" button to save the new field. This option is only available if you have the 'Write Admin' permission.
Update/Delete Custom Fields
To update or delete existing custom fields for a selected job type:
Select the job type from the dropdown menu. The existing custom fields for the selected job type will be displayed.
Update the field title, description, and options (for dropdown fields) as needed.
Click the "Update" button to save the changes or the "Delete" button to remove the custom field.
Client Type Management
This section allows administrators to create and delete client types. Client types define the structure of client information, including the fields required for each type. Follow the instructions below to manage client types effectively.
Create Client Type
To create a new client type, follow these steps:
Enter the client type name in the provided input field.
Preset fields ("Name," "Address," and "Phone") are already included. You can add additional fields as needed:
Click the "Add Field" button to add a new field.
For each new field, enter the field name and select the field type from the dropdown menu.
If the field type is "ENUM" or "SET," provide the options as a comma-separated list.
Enable Photo Gallery Creates a photo Gallery for Client system
Click the "Create Client Type" button to save the new client type. This option is only available if you have the 'Write Admin' permission.
Field Types
VARCHAR(255): Text field with a maximum length of 255 characters. Use this for short text inputs like names, addresses, etc.
DATE: Field to store a date. Use this for inputs that require a specific date.
TIMESTAMP: Field to store a timestamp. This includes both date and time, which is useful for logging events or actions.
TIME: Field to store a specific time of the day. Use this for inputs that require only the time, like meeting times or working hours.
CHAR: Locked Field to hold data
TEXT: Long text field. Use this for larger text inputs like comments, descriptions, or notes.
TINYINT(1): Boolean field. This can store a 1 (true) or 0 (false) value, useful for yes/no or on/off inputs like checkboxes.
SET: Field to store multiple values from a predefined list. Provide options as a comma-separated list. This is useful for inputs that can have multiple selections like categories, tags, or preferences.
Update Client Type
To update an existing client type, follow these steps:
Select the client type you wish to update from the dropdown menu.
To add a new field:
Enter the field name in the provided input field.
Select the field type from the dropdown menu.
If the field type is "SET," provide the options as a comma-separated list.
To remove existing fields:
Select the fields you want to remove by checking the corresponding checkboxes.
Click the "Update Client Table" button to save the changes. This option is only available if you have the 'Write Admin' permission.
Delete Client Type
To delete an existing client type, follow these steps:
Select the client type you want to delete from the dropdown menu.
Click the "Delete Client Type" button to remove the selected client type. Note that this action cannot be undone and will permanently delete the client type and its associated data.
Assign Jobs
The "Assign Jobs" section allows users to create and assign jobs to individuals or groups within the system. Below are the steps and details needed for each operation.
Job Description
Allows the user to enter a detailed description of the job.
Job Type
The user can select the type of job from a dynamically populated dropdown list.
Deadline
The user can set a deadline for the job using a datetime-local input field.
Priority
The user can select the priority level of the job (Low, Normal, High).
Assigned To
The user can assign the job to a specific user from a dropdown list.
User Group
Optionally, the user can select a group to which the job will be assigned.
Attach Client
The user can search for and attach clients to the job. The search results are displayed dynamically as checkboxes.
Submit
The "Create Job" button submits the form, creating the job and attaching the selected clients.
All Jobs
The "All Jobs" section provides a comprehensive view of all jobs within the system, allowing users to search, filter, and manage job assignments. Below are the details and functionalities available in this section.
Search Jobs
The user can search for jobs using the search bar. The table dynamically updates to show jobs that match the search query.
Enable Auto Update
Users can enable or disable auto-update functionality. When enabled, the page refreshes every 10 seconds to display the most current job data.
Assign Selected Jobs
The user can select multiple jobs and assign them to a specific user by choosing from a dropdown list and setting the priority level. Upon submission, the selected jobs are reassigned accordingly.
Column Visibility
Users can toggle the visibility of specific columns in the job table to customize their view. The available columns are:
Select
Job ID
Description
Job Type
Status
Reassign
AssignedTo
Client Info
Details
Job Table
The job table displays the following columns:
Select: Allows the user to select jobs using checkboxes.
Job ID: Displays the unique identifier for each job.
Description: Provides a brief description of the job.
Job Type: Shows the type of job.
Status: Indicates the current status of the job.
Reassign: Contains a dropdown to reassign the job to a different user.
AssignedTo: Displays the username of the user to whom the job is assigned.
Client Info: Provides information about the client associated with the job, including name, address, phone, and email. If available, the address is linked to a Google Maps search.
Details: A link to view more detailed information about the job.
View Notices
The "View Notices" section allows users to view jobs based on their associated notice types. Users can select a notice type to filter the jobs accordingly. Below are the details and functionalities available in this section.
Select Notice Type
The user can select a notice type from a dynamically populated dropdown list. Upon selection, the form automatically submits, and the jobs are filtered based on the selected notice type.
Job Table
The job table displays the following columns:
JobId: Displays the unique identifier for each job.
Description: Provides a brief description of the job.
JobType: Shows the type of job.
Status: Indicates the current status of the job.
Client Info: Provides information about the client associated with the job, including name, address, phone, and email. If available, the address is linked to a Google Maps search.
Work Order Details: A link to view more detailed information about the job.
Enable Auto Update
Users can enable or disable auto-update functionality. When enabled, the page refreshes every 10 seconds to display the most current job data.
Dashboard Management
This section provides an overview of the main dashboard functionalities and user navigation capabilities within the application.
Centralized user interface for accessing various system features.
Session-based user verification for secure access, ensuring only logged-in users can interact with the dashboard.
Incorporates FullCalendar to visually display job due dates, enhancing scheduling and time management.
Embedded chat sidebar for easy user communication, allowing users to view and search for other users, select a contact, and engage in real-time chat.
Sticky Notes feature for adding personalized notes on the dashboard, enabling users to create, drag, and delete notes that are color-coded and persist between sessions.
Timezone setting configured to Central Standard Time (CST) for consistent time tracking across user interactions.
Security checks to prevent unauthorized access, including session validation and prevention of direct access to sensitive pages.
Chat Support
This section provides an overview of the Chat system, enabling real-time communication between users within the application.
Allows users to view a sidebar with a searchable list of available contacts for chat interactions.
Displays the latest message for each contact, making it easier for users to quickly find ongoing conversations.
Supports selecting a user to initiate or continue a chat, displaying the chat history in the main chat area.
Includes a responsive chat box where users can send and receive messages in real-time, with messages distinguished by sender and receiver styles.
Utilizes periodic polling every 3 seconds to fetch new messages, ensuring the chat is updated with minimal delay.
Detailed Reporting Dashboard
This section provides an overview of the Detailed Reporting Dashboard, designed to monitor job metrics and generate reports based on various criteria.
Displays summary metrics and visual charts to analyze system performance and job status.
Includes filter options to generate customized reports based on Job Type, Start Date, and End Date.
Presents job data in a tabular format, including details like Job ID, Job Type, Assigned User, Status, Deadline, and Priority.
Offers export functionality, allowing users to download reports in PDF and Excel formats for offline review and analysis.
Visualizes data using charts powered by Chart.js, showing Task Completion Rate and Late Jobs, providing quick insights at a glance.
## Admin Menu: Schedule System
Admin Menu: Schedule System
This section describes how the scheduling interface functions and how administrators can view, create, and manage both user and job schedules from the admin panel.
Menu Location
To access the schedule system, go to:
Admin Panel → Master Schedule System
This screen is available to users with the Write Admin permission depending on functionality access.
Features
Monthly Calendar View: View all job-related schedule entries and assignments for the month. Click events to edit them via modal.
Weekly Grid View: See a week-by-week breakdown of employee shifts, including recurring and one-time shifts.
Create & Edit User Schedules: Assign shifts by employee and either day of week (recurring) or specific date.
Job Assignments: Jobs scheduled in the Jobs table are shown in the calendar alongside user shifts.
Drag-and-Drop: Admins with write permissions can drag shifts between users and days to adjust the schedule.
Modals for Shifts and Jobs: Clean modal interface allows editing of time blocks, repeating shifts, and job info.
How to Use
Open the Schedule page from the admin dashboard.
Use the top navigation to browse months or weeks.
To assign a new shift, use the Assign Work Hours form at the bottom of the page.
Click a job or shift to open the modal for editing, or drag it to a new user/day to update it instantly.
Delete any shift using the 🗑️ icon, or modify via ✏️.
Permissions
Write Admin — Required to create, edit, or drag user shifts.
Write Admin — Required to manage job event editing within the calendar modal.
Related Files
schedule.php — Main interface and logic for rendering schedule views
set_work_hours.php — Handles saving of new or edited user shifts
save_shift.php — Modal shift editing logic
delete_shift.php — Handles AJAX shift deletion
update_shift_day.php — Supports drag-and-drop shift movement
update_job.php — Modal save logic for job schedule updates
Add New Inventory Item
This section allows users to add new items to the inventory database.
Input fields for item details:
Item Name: Text input for the item's name.
Description: Textarea for a brief item description.
Quantity: Numeric input for the quantity of the item.
Price: Numeric input for the item's price, supporting decimal values.
SKU: Text input for the item's unique identifier (SKU).
A submit button triggers an AJAX request to send data to the database.
Displays success or error messages dynamically after the request.
Edit Inventory Items
This section provides functionality to edit existing inventory items.
Inventory items are dynamically loaded from the database using AJAX.
Each item is displayed with editable fields:
Name: Editable name field.
Description: Editable description textarea.
Quantity: Numeric input to update stock.
Price: Editable numeric price field with decimal support.
SKU: Editable SKU field.
Submitting changes sends an AJAX request to update the item in the database.
Displays success or error messages and refreshes the inventory list automatically.
Update Inventory Stock
This section provides functionality to update inventory stock levels.
A dropdown menu dynamically populated with available inventory items.
Input fields:
Quantity: The quantity to add or remove.
Transaction Type: Dropdown to select "Add Stock" or "Remove Stock."
Notes: Optional textarea for transaction details.
A submit button triggers an AJAX request to update stock levels in the database.
Displays success or error messages dynamically and refreshes the dropdown after updates.
View Inventory
This section provides a table view of all inventory items.
Displays the following columns for each item:
ID: Unique identifier for the item.
Name: The item's name.
Description: A brief description of the item.
Quantity: The current stock level.
Price: The item's price.
SKU: The item's unique identifier (SKU).
Data is retrieved dynamically from the database using PHP.
The table updates automatically when new items are added or edited.
Manage Suppliers
This section provides functionality for managing suppliers in the system.
Add Supplier Form:
Name: Text input for the supplier's name.
Contact Information: Textarea for contact details.
A submit button sends an AJAX request to add the supplier to the database.
Displays success or error messages dynamically after the request.
View and Manage Suppliers:
Displays a table of existing suppliers with columns:
ID
Name
Contact Information
Actions (e.g., delete button).
Suppliers are fetched dynamically using AJAX.
The delete button sends a request to remove the supplier from the database.
Service Type Management
This section allows you to create, delete, and manage service types, upload KML files, and configure service area details.
Create Service Type
To create a new service type:
Enter the service type in the provided input field.
Click the "Create Service Type" button to save it. This option is only available if you have the 'Write Admin' permission.
Delete Service Types
To delete existing service types:
Select the service types you want to delete by checking the corresponding checkboxes.
Click the "Delete Selected Service Types" button to remove them from the system.
Service Type Setup
To configure a service type with additional details:
Select the service type from the dropdown menu.
Upload a KML file to define the service area.
Provide a public description that customers can see.
Provide an admin description for internal use.
Click the "Save Details" button to save the configuration.
View Existing KML Files
To view KML files associated with a service type:
Select a service type from the dropdown menu.
Existing KML files and their descriptions will be displayed.
Service Area Map
The service area map dynamically displays polygons from uploaded KML files. To update the map:
Select a service type to load its polygons.
The polygons will be drawn on the map to indicate service areas.
Click on a polygon to edit or add notes about the service area.
Admin Menu: Twilio IVR & SMS Menu System
This section explains how the admin_menu.php interface is used to build and manage a Twilio-driven interactive menu system that supports both voice and SMS text-based interactions.
Purpose
The admin_menu.php file provides a visual interface for administrators to define menu trees for use with Twilio. These menus can be used in:
Voice Calls: Callers press digits to navigate menus (IVR).
Text Messages: Users reply with numbers or keywords to trigger actions or receive replies.
Menu Options
Each entry in the menu is saved in the twilio_menu database table and includes the following fields:
Parent Menu: Allows nesting for submenus. Leave blank for top-level options.
Prompt: Internal label to describe the action/menu step.
Digit: The number or keyword the user responds with (used in both voice and SMS).
Action Type: Defines what happens when the digit or reply is received:
message — Send a text or voice message back.
forward — Forward the call to a phone number.
menu — Navigate to a submenu.
api_call — Call an external API (can use variables like {caller_number}).
Action Value: The message content, destination phone number, submenu ID, or API URL.
Sort Order: Determines the order in which options appear under the same parent.
How to Use
Go to admin_menu.php as an administrator.
Use the Add Menu Option form to create new entries for voice or SMS flows.
Choose the appropriate action type and value depending on the desired response or behavior.
Save the entry and view it in the Existing Menus table for verification.
The menu structure is automatically used by both incoming voice calls and SMS messages through twilio_webhook.php.
Supported Input
Voice IVR: Digit press via phone keypad (e.g., "Press 1 to speak to support")
SMS Response: User replies with digits or keywords (e.g., "1" or "support")
Related Files
twilioConfig.php — Stores Twilio credentials and global settings.
twilio_webhook.php — Receives and routes both incoming calls and text messages using the defined menu structure.
Task System
The Task System allows users to view, filter, and manage tasks assigned to them either directly or via their role.
Admins with the "Task Management" permission can also create new tasks. Tasks can be filtered by different statuses such as All, Today, This Week, Pending, or Completed.
Key Features:
Task Assignment: Tasks are assigned either to a specific user (AssignedUserId) or a role (AssignedRoleId).
Filtering: Users can filter tasks by:
✅ All — View all tasks assigned.
📆 Today — Tasks due today.
🗓️ This Week — Tasks due this week.
⏳ Pending — Tasks not yet completed by the user.
✅ Completed — Tasks the user has completed.
Status Display: Each task is marked as Pending, Completed, or Late based on its due date and completion status.
Task Completion Tracking: The system checks the task_responses table to determine if a user has completed a task.
Create Task Button: Available only to users with "Task Management" permission.
Tables Used:
tasks — Stores all task information such as Title, Description, Frequency, DueDate, AssignedUserId, AssignedRoleId.
task_responses — Records which user has completed which task.
task_questions — Defines the questions linked to a task (e.g., Yes/No, Paragraph responses).
Permissions:
Task Management: Required to create new tasks.
Task Creation Process:
Admins can create a new task by filling out the task form available through the "➕ Create New Task" button.
The task form collects:
Title: Name of the task.
Description: Optional details about the task.
Frequency: Options include Once, Daily, Weekly.
Due Date: When the task should be completed.
Assigned User: (optional) Assign the task to a specific user.
Assigned Role: (optional) Assign the task to all users in a role.
Admins can also attach multiple task questions:
Question Text: The text users must answer when completing the task.
Type: Either Yes/No or Paragraph answer types.
Required: Option to make the question mandatory or optional.
Questions can be dynamically added or removed when creating a task.
Once the task and its questions are saved, it becomes available to the assigned user(s) or role(s).
Important Notes:
Tasks are considered late if the current date is past the DueDate and the user has not completed it.
If no tasks match the selected filter, a message is shown: "No tasks found for this filter."
When creating tasks, both assigning to a specific user or a role is optional, but at least one should generally be selected for practical use.