Commit Graph
41 Commits
Author SHA1 Message Date
Jeppe Bundgaard 28b571e2e6 Add unit tests for advanced target duration parsing, goal range calculations, and Workfeed query normalization. Extend OpenAPI spec with updated schemas and examples. 2026-03-24 11:35:13 +01:00
Jeppe Bundgaard 8c9388546b Add advanced target duration configurations and parsing logic to Goals module. Update Workfeed with new CompanyID config. Extend OpenAPI spec with detailed schema mappings and examples. 2026-03-24 11:23:08 +01:00
Jeppe Bundgaard 16bcc3a00c Add custom monthly target calculation in goals_progress_alert_renderer for specific periods. 2026-03-09 09:58:48 +01:00
Jeppe Bundgaard 32f017778f Add voice call management endpoints and enhance logging for HTTP requests 2026-02-27 01:29:32 +01:00
Jeppe Bundgaard a0727cd14e Add optional per-department weekly targets and update related calculations 2026-02-27 01:11:22 +01:00
Jeppe Bundgaard f74210bca8 Add date range fields to goal criteria and update OpenAPI documentation 2026-02-27 00:46:30 +01:00
Jeppe Bundgaard 647b7f2d94 Refactor progress calculation to avoid mutating instance and improve clarity 2026-02-27 00:32:41 +01:00
Jeppe Bundgaard ea7633a908 Enhance departmental goal tracking by adding yearly and to-date progress calculations 2026-02-27 00:31:24 +01:00
Jeppe Bundgaard ece9f5108a Enhance progress tracking by adding yearly and to-date calculations for departmental targets 2026-02-27 00:23:02 +01:00
Jeppe Bundgaard 88f4f34c34 Update department daily targets to support floats
- Refactored `department_daily_targets` logic to accept and process float values instead of integers.
- Adjusted relevant type declarations, validations, and calculations in `GoalsCriteria`.
- Updated OpenAPI schema to align with new data type for per-department daily targets.
2026-02-25 14:40:26 +01:00
Jeppe Bundgaard 49f07c40c8 Add time-based progress tracking and department-specific target calculations
- Added support for `today`, `week`, and `month` progress tracking in `GoalsCriteria`.
- Introduced `setTimeframeByName` method to manage time-based progress criteria.
- Enhanced `calculateProgressFromArray` and `calculateProgressDetailsFromArray` to include customizable timeframes.
- Updated departmental progress calculations with detailed breakdowns for multiple time periods.
- Replaced obsolete single-value progress tracking with comprehensive progress details.
2026-02-25 14:30:03 +01:00
Jeppe Bundgaard 11a677416b Enhance department goal criteria handling
- Refactored department daily targets logic for optimization and better maintainability.
- Ensured department-specific targets are validated, sanitized, and consistently applied in updates.
- Improved database interaction safety by preventing unnecessary updates for unchanged object properties.
- Adjusted route and API behavior for criteria and department updates to handle validations comprehensively.
2026-02-25 14:15:19 +01:00
Jeppe Bundgaard ffc5d6bc21 Add support for per-department custom daily targets
- Introduced `department_daily_targets` field in criteria, renderer, and API to define daily target overrides for departments.
- Enhanced daily target logic to honor per-department overrides while maintaining backward compatibility.
- Updated SMS, email, and Slack renderers for consistent enforcement of text length limits with fallback to non-mbstring functions.
- Refactored order item update logic to improve database interaction safety by using setters.
2026-02-25 13:03:04 +01:00
Jeppe Bundgaard c591439240 Refactor goals_progress_alert_renderer to separate period department lines from totals
- Introduce `periodLines` array for improved clarity and logic separation.
- Update total expression to include period label for better formatting.
- Move department lines and blanks to `periodLines` and merge into output at the end of each period.
2026-02-02 11:25:45 +01:00
Jeppe Bundgaard 4816075041 Add total progress summary line in goals_progress_alert_renderer
- Include total progress calculations across departments for each period.
- Add percentage comparison against target when applicable.
2026-02-02 10:42:33 +01:00
Jeppe Bundgaard 17325f565e Update Slack notification logic and refine COUNT_ONLY summary rendering
- Swap `send_message` with `send_webhook_message` to fix departmental Slack notification issues.
- Adjust `COUNT_ONLY` in `renderDanishPeriodSummary` to exclude targets for raw count-focused alerts.
2026-01-29 20:31:05 +01:00
Jeppe Bundgaard 4f9c91dceb Refactor goals_progress_alert_renderer for improved date handling and department target calculations
- Replace immutable/mutable `DateTime` conversions with safer handling in target and progress calculations.
- Update `getDailyTarget` to normalize timeframes and improve operating day computations.
- Refine department-specific target calculation logic for enhanced accuracy in multi-department setups.
2026-01-29 20:24:47 +01:00
Jeppe Bundgaard cd2190d976 Refactor goals_progress_alert_renderer for enhanced department summary rendering
- Simplify multi-period department progress calculations by restructuring logic to render by period first.
- Add support for daily target calculations and timeframe-based target adjustments in `goals_criteria`.
- Introduce `countOperatingDaysInTimeframe` and related helper methods for improved alert scheduling and progress tracking.
2026-01-29 20:20:05 +01:00
Jeppe Bundgaard b3b12b58fd Refactor goals_criteria and goals_progress_alert_renderer for improved department filtering and summary rendering
- Add cloning logic in `withDepartmentFilter` to avoid mutating original `goals_criteria` objects.
- Rename method parameter in `render` and refactor `renderDanishPeriodSummary` for enhanced readability and flexibility.
- Introduce helper methods for date range and criteria window adjustments to streamline department progress calculations.
2026-01-29 19:42:03 +01:00
Jeppe Bundgaard 84bfbdad25 Refactor Slack notifications and enhance departmental progress calculation
- Replace `send_webhook_message` with `send_message` for improved Slack notification rendering using `goals_progress_alert_renderer`.
- Add methods for calculating and retrieving departmental progress and distribution in `goals_criteria`.
- Update `renderDanishPeriodSummary` and Slack cron logic to support departmental-specific summaries.
- Include departmental progress in serialized goal objects for better reporting.
2026-01-29 18:30:04 +01:00
Jeppe Bundgaard 5a8bcfad90 Introduce Slack-specific bold formatting for Danish header keys in goals_progress_alert_renderer
- Add `applySlackBoldKeys` method to bold select headers and periods for Slack alerts.
- Update rendering logic to apply Slack-specific formatting when destination is Slack.
2026-01-27 10:04:15 +01:00
Jeppe Bundgaard d01bdb7ea3 Enhance Slack notifications and pluralize Danish labels in goals_progress_alert_renderer
- Add support for sending Slack notifications to multiple department webhooks.
- Adjust Danish label pluralization based on counts for departments, customers, and products.
2026-01-27 09:57:13 +01:00
Jeppe Bundgaard 6d1e10d564 Update customer name resolution in goals_progress_alert_renderer
- Prefer economic customer name via `getCustomerNames` when available.
- Add fallback to `display_name` and customer number.
2026-01-27 09:46:28 +01:00
Jeppe Bundgaard 5536475102 Add multi-line progress alert rendering and support for department, customer, and product names
- Introduce `renderDanishPeriodSummary` to display detailed progress (daily, weekly, monthly) with optional targets.
- Add `commaNamesFromObjects` helper to extract and format names for departments, customers, and products.
- Update alert composition logic to differentiate between single-line and multi-line rendering.
- Extend `progress_alert_format` to support new tokens `{department_names}`, `{customer_names}`, and `{product_names}`.
2026-01-27 09:43:23 +01:00
Jeppe Bundgaard 1a5084891d Refactor progress_alert_format parsing in goals_criteria to support object structures and update enum mapping in goals_criteria_progress_alert_style 2026-01-27 09:20:27 +01:00
Jeppe Bundgaard 043382c6f4 Add support for weekday-specific and time-of-day progress alerts in goals_criteria
- Introduce `progress_alert_weekdays` and `progress_alert_time_of_day` fields with parsing, validation, and sanitization logic.
- Add `goals_criteria_progress_alert_weekday` enum for supported weekdays.
- Update `toArray` and OpenAPI specification to support new fields and maintain backward compatibility.
2026-01-27 08:52:12 +01:00
Jeppe Bundgaard 2f6ae98d42 Add support for progress alert rendering in goals module
- Implement `goals_progress_alert_renderer` service to compose and render progress alert messages based on destination, progress type, and style.
- Add format classes (`sms_progress_alert_format`, `email_progress_alert_format`, `slack_progress_alert_format`) with length constraints.
- Extend `goals_criteria` to include alert customization properties (`progress_alert_destination`, `progress_alert_progress_type`, `progress_alert_style`, `progress_alert_format`) with parsing and validation logic.
- Update `toArray` and `fromJson` methods to support new fields.
2026-01-27 08:44:44 +01:00
Jeppe Bundgaard 845bd0c6c6 Add enums and trait for progress alert customization in goals module
- Introduce `goals_criteria_progress_alert_style`, `goals_criteria_progress_alert_progress_type`, and `goals_criteria_progress_alert_destination` enums to define alert styles, progress types, and destinations.
- Add `goals_criteria_progress_alert_format_t` trait, including rendering and JSON serialization capabilities.
2026-01-27 08:34:52 +01:00
Jeppe Bundgaard ad0277ff17 Enhance input validation, unicode handling, and sanitization across department goal criteria
- Add `validateAndSanitize` method to `goals_criteria` for input validation and defaulting incorrect values.
- Ensure JSON encoding in `response` and database interactions respects Unicode (`JSON_UNESCAPED_UNICODE`).
- Sanitize and validate input for `department_goals_o::add` and criteria usage.
- Fix header character encoding in response (`Content-Type: application/json; charset=utf-8`).
- Update criteria `label` sanitization with trimming, length limits, and safe character handling.
2026-01-27 08:20:33 +01:00
Jeppe Bundgaard f58eb87131 Add progress_alert_frequency to goals_criteria with JSON parsing and export support
- Introduce `goals_criteria_progress_alert_frequency` property in `goals_criteria` class to handle alert frequencies.
- Extend `fromJson` to parse `progress_alert_frequency` with support for camelCase input.
- Update `toArray` to include `progress_alert_frequency` in serialized output.
2026-01-26 19:43:52 +01:00
Jeppe Bundgaard da65d0decd Enhance goals_criteria::fromJson with input sanitization, deduplication, and validation
- Add robust validation for JSON input, including error handling for malformed or invalid data.
- Sanitize and validate all fields (`type`, `target`, `label`, `start`, `end`) with additional constraints like trimming, length limits, and proper date handling.
- Implement deduplication for `users`, `departments`, and `products` to ensure unique and valid entries.
- Ensure `end` date does not precede `start` by swapping when necessary.
2026-01-26 19:27:31 +01:00
Jeppe Bundgaard 0491a2ad1b Add VISITS criteria type and implement visit counting logic in goals_criteria
- Introduce `VISITS` as a new goal criteria type in `goals_criteria_type` enum.
- Extend `goals_criteria` with `countVisits` method to compute unique visit counts based on criteria filters.
- Update result computation logic in `goals_criteria` to support `VISITS`.
2026-01-26 19:24:51 +01:00
Jeppe Bundgaard 83b0a27c93 Delegate result computation to goals_criteria and add revenue calculation logic. 2026-01-26 19:16:46 +01:00
Jeppe Bundgaard 52a2f38f81 Add REVENUE criteria type and goals_label_t trait to enhance goal labeling and criteria management
- Introduce `REVENUE` as a new goal criteria type in `goals_criteria_type` enum.
- Add `goals_label_t` trait for handling label properties in goal criteria.
- Extend `goals_criteria` to support labels, including serialization and input validation.
2026-01-26 18:58:59 +01:00
Jeppe Bundgaard c1b7f5bad6 Add progress calculation and enhance department goal management
- Introduce progress-related functionality in `goals_criteria` and enumeration for alert frequencies.
- Add `calculateProgressFromArray` for progress evaluation based on criteria arrays.
- Extend `department_goals_o` with `name` property and optional inclusion of progress in goal exports.
- Update OpenAPI spec with endpoints and schemas for department goal management.
2026-01-26 18:51:31 +01:00
Jeppe Bundgaard d1963b5299 Add department_goals_o object and enhance JSON export for goals module
- Introduce `department_goals_o` for managing department-specific goals with criteria.
- Enhance `goals_criteria` with `toArray` and `toJson` methods for canonical JSON export.
- Update `goals` to delegate JSON export to `goals_criteria`.
2026-01-26 17:12:23 +01:00
Jeppe Bundgaard 42d2889934 Enhance goals_criteria to parse users, departments, and products from input arrays
- Add parsing logic for users, departments, and products, supporting array inputs with IDs or objects.
- Filter out invalid entries and update relevant criteria properties.
2026-01-26 16:46:16 +01:00
Jeppe Bundgaard 9312f9003e Add JSON import/export functionality for goals module
- Implement `exportToJson` and `importFromJson` methods in `goals` for serialization and deserialization.
- Add `fromJson` method in `goals_criteria` to parse criteria from JSON input.
- Extend `exampleRoute` for debugging with sample JSON-based goal creation.
- Update `index.php` to autoload new `goals` module classes and dependencies.
2026-01-26 16:43:59 +01:00
Jeppe Bundgaard 51b8198a67 Introduce goals module with methods for result, percentage, and remaining calculations
- Add `goals` class for managing goal metrics and calculations.
- Extend `goals_criteria` with timeframe initialization and validation.
- Implement `getListByCriteria` in `order_items_o.php` for product-based goal evaluation.
- Add unit tests for `goals` to validate
2026-01-26 16:24:23 +01:00
Jeppe Bundgaard f94efa7c59 Simplify count method by inlining variable assignments in goals_criteria_products. 2026-01-26 16:09:09 +01:00
Jeppe Bundgaard 4bfda5aea4 Introduce modular goal criteria system for users, departments, and products
- Add `goals_criteria` base class implementing customizable goal criteria.
- Introduce interfaces and traits for modular handling of users, departments, and products in goal criteria.
- Include enumeration for goal types (`goals_criteria_type`).
- Implement timeframe and target management through traits.
- Provide initial configuration for enabling the goals module.
2026-01-26 16:01:47 +01:00