Commit Graph
885 Commits
Author SHA1 Message Date
Jeppe Bundgaard 3fcccd8e5a Add AlfaSlabOne-Regular.ttf font to dynamicimages module 2026-01-28 15:56:38 +01:00
Jeppe Bundgaard d03151c426 Add highlighted button rendering to machine_1 layout
- Introduce `drawHighlightedButtons` method for drawing button grids based on configurable rows, columns, and spacing.
- Add new constants for button size, spacing, and grid dimensions.
- Update asset usage to include `machine_1_button_highlighted_transparent`.
2026-01-28 14:57:44 +01:00
Jeppe Bundgaard a2dc4da2bf Refactor machine_1 rendering logic and add new assets
- Replace `IMAGE_WASH_PROGRAMS` with `IMAGE_PROGRAMS_WHEEL` and add `IMAGE_BUTTON_HIGHLIGHTED`.
- Introduce `drawProgramWheel` and `drawThumb` methods for improved modularity.
- Adjust thumb properties (`$thumb_position`, `$thumb_size`) and refine positioning logic.
- Update asset loading to include the new `machine_1_button_highlighted_transparent` asset.
2026-01-28 14:27:06 +01:00
Jeppe Bundgaard 43eeb14099 Update machine_1 default thumb position and adjust thumb X-coordinate positioning
- Set `$thumb_position` default value to `10` for improved alignment.
- Tweak thumb X-coordinate from `620` to `650` for better rendering consistency.
2026-01-27 15:04:17 +01:00
Jeppe Bundgaard 2e7376f00a Add centered asset drawing support and refine image transformations
- Introduce `drawAssetCentered` method in `dynamicimages_image_t` for drawing assets visually centered on specified coordinates.
- Reset virtual canvas/page after image rotation in both `dynamicimages_asset_t` and `dynamicimages_image_t` to ensure consistent positioning.
- Update `machine_1` logic to use `drawAssetCentered` for improved thumb drawing and dynamic pivot alignment.
- Adjust thumb rotation calculations and positioning logic for better visual rendering.
2026-01-27 14:56:58 +01:00
Jeppe Bundgaard 493b4a2d6e Add resize method to dynamicimages_asset_t and enhance machine_1 thumb rendering
- Introduce `resize` method in `dynamicimages_asset_t` for resizing assets in memory with or without aspect ratio preservation.
- Refine `machine_1` rendering logic to dynamically calculate and apply thumb width based on height.
2026-01-27 14:10:45 +01:00
Jeppe Bundgaard ee305757f2 Implement in-memory asset manipulation and enhance machine_1 drawing logic
- Add in-memory asset handling to `dynamicimages_asset_t` with methods for loading, rotating, cloning, and clearing `Imagick` instances.
- Update `dynamicimages_image_t` to use in-memory images when available for dynamic asset composition.
- Replace thumb reference in `machine_1` with new `machine_1_wash_programs_thumb_standalone_transparent` asset.
- Enhance `machine_1` to resize rotated thumb dynamically while drawing.
2026-01-27 12:35:50 +01:00
Jeppe Bundgaard 3cea9659cb Add servePicture method to dynamicimages_image and update machine_1 with thumb rotation logic
- Introduce `servePicture` method to `dynamicimages_image_t` and its interface.
- Add `$thumb_position` property and `getRotationThumbPosition` method to `machine_1`.
- Update `drawAsset` logic in `machine_1` to apply rotated thumb for dynamic rendering.
2026-01-27 12:22:13 +01:00
Jeppe Bundgaard d7705b8f34 Add support for dynamic image composition with Imagick in dynamicimages module
- Update `Dockerfile` to install `Imagick` dependencies and enable the extension.
- Enhance `dynamicimages_image_t` with canvas lifecycle methods (`initImageCanvas`, `clearImage`, etc.), transformations (`resize`, `crop`, `rotate`, etc.), and explicit asset compositing.
- Extend `dynamicimages_image_i` interface with corresponding method signatures.
- Refactor `machine_1` to utilize dynamic image canvas and layered asset drawing.
2026-01-27 12:05:53 +01:00
Jeppe Bundgaard e2521e222f Enhance dynamicimages module with refined asset management and image path configuration
- Update `dynamicimages_asset` constructor to prepend working directory to paths.
- Add helper methods (`getPath`, `getWidth`, `getHeight`) to `dynamicimages_asset`.
- Extend `dynamicimages_image_t` trait with debugging and path configuration utilities.
- Refactor asset path handling in `machine_1` with constants for image files.
- Load `dynamicimages` interfaces, traits, classes, helpers, and configurations in `index.php`.
2026-01-27 11:21:07 +01:00
Jeppe Bundgaard f1f7ba1d46 Introduce dynamicimages module for managing dynamic image assets
- Add core `dynamicimages_c` class for module configuration and management.
- Implement asset management with `dynamicimages_asset` class and related interface/traits.
- Add support for image operations via `dynamicimages_tool` enum.
- Include `dynamicimages_image` class for handling grouped assets with path configuration.
- Introduce `machine_1` image example with associated assets under `dynamicimages`.
2026-01-27 11:07:30 +01:00
Jeppe Bundgaard 8528dd82f4 Add GoalsProgressAlertsCron for scheduled department goal progress notifications
- Introduce a new cron job to send progress alerts for department goals based on criteria.
- Support alert destinations: Slack (with fallback webhook), Email, and SMS (currently manual only).
- Evaluate frequency rules (daily, weekly, monthly, or change-based) with configurable time-of-day and weekdays.
- Deduplicate notifications using Redis keys for each goal and alert slot.
- Implement detailed alert scheduling, rendering, and dispatch logic.
2026-01-27 10:15:40 +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 7fd4ac888a Add POST endpoint /goals/department/progress-alert/test to send test progress alerts
- Define alert destinations (Slack, Email, SMS) with customizable parameters.
- Implement OpenAPI specification and validate permissions, goal existence, and configuration.
2026-01-27 09:11:17 +01:00
Jeppe Bundgaard 6468bcb481 Add endpoint to send test progress alerts for department goals
- Implement `/goals/department/progress-alert/test` POST endpoint to send test progress alerts.
- Support email, SMS, and Slack as alert destinations with customizable parameters.
- Validate user permissions, goal existence, and alert configuration before dispatch.
- Extend alert rendering logic with destination-specific delivery methods.
2026-01-27 09:09:10 +01:00
Jeppe Bundgaard 9d34decbb6 Add missing helper files for progress alert customization in goals module
- Include `goals_criteria_progress_alert_destination`, `goals_criteria_progress_alert_progress_type`, `goals_criteria_progress_alert_style`, and `goals_criteria_progress_alert_weekday` helpers in `index.php`.
2026-01-27 09:00:32 +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 4eacd04c2a Update OpenAPI spec: Add progress alert customization fields to goals_criteria schema
- Introduce `progress_alert_destination`, `progress_alert_progress_type`, `progress_alert_style`, and `progress_alert_format` fields with descriptions, examples, and enum values.
- Ensure backward compatibility with support for camelCase inputs.
2026-01-27 08:46:14 +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 f5e715d113 Preserve unicode characters in goals_criteria JSON encoding for department goals 2026-01-27 07:51:58 +01:00
Jeppe Bundgaard edbd7f539c Add goals_criteria_progress_alert_frequency helper to goals module 2026-01-26 20:14:14 +01:00
Jeppe Bundgaard 32b5816a36 Update OpenAPI spec: Add label field to goals_criteria schema 2026-01-26 19:47:15 +01:00
Jeppe Bundgaard 8009e4029c Update OpenAPI spec: Add progress_alert_frequency to goals_criteria schema 2026-01-26 19:46:18 +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 b4b72d7537 Add access control for department goal operations in departmentGoalsRoute
- Restrict goal listing and retrieval based on user permissions and department access.
- Enforce department-level access control for goal creation, updates, and deletions.
- Validate user actions against `superuser` status and department memberships.
2026-01-26 17:22:17 +01:00
Jeppe Bundgaard 4a0e86164c Add departmentGoalsRoute for CRUD operations on department goals
- Implement route for listing department goals with optional pagination and single-goal retrieval.
- Add logic to create, update, and delete department goals with validation for input and permissions.
- Support department and criteria management via JSON parsing and object transformation.
2026-01-26 17:18:01 +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
Jeppe Bundgaard e1e6d9c911 Sort departments by order_priority in Slack statistics notification. 2026-01-26 14:11:13 +01:00
Jeppe Bundgaard 9b9713ecc1 Add order_priority field to departments
- Introduce `order_priority` property in `departments_o.php`.
- Update `departmentsRoute.php` to handle `order_priority` in input and output.
- Adjust object initialization and serialization for the new field.
2026-01-26 13:53:25 +01:00
Jeppe Bundgaard 16f041600c Refactor Slack notification logic in departments_o.php and exampleRoute.php
- Update `send_webhook_message` to include custom department webhook.
- Add `sendSlackInternalStatisticNotification` to handle additional statistics notifications.
2026-01-26 13:15:38 +01:00
Jeppe Bundgaard 88d3e20de6 Expire department webhook in Redis and refactor Slack notification logic
- Add 5-minute expiration for cached department webhooks in `redis.php`.
- Cast department ID to integer in `departments_o.php`.
- Refactor Slack notification logic to use `send_webhook_message` for custom department webhooks.
- Update `send_webhook_message` visibility from protected to public in `slack.php`.
2026-01-26 13:09:21 +01:00
Jeppe Bundgaard 64faea9324 Add password reset endpoint and refactor booking count logic
- Introduce `POST /auth/password-reset/request` endpoint in test and `authRoute.php`.
- Refactor bookings route to use a new method `getDailyUnfulfilledBookingsCountForDepartment`
2026-01-22 14:38:54 +01:00
Jeppe Bundgaard 29c53c3b70 Improve Slack message formatting and update date handling in department statistics
- Apply Markdown formatting to Slack messages for better readability.
- Adjust date range to end on the previous day in `workerRoute.php`.
- Refactor department loop output for consistent indentation and styling.
2026-01-22 12:53:38 +01:00
Jeppe Bundgaard e0e479a15d Introduce method-level caching for department reports to enhance performance
- Wrap report calculation logic in `methodCacheWithParameters` for 2-minute caching.
- Standardize reusable caching logic in `db_object_t` trait.
- Refactor query-based methods to integrate caching and improve maintainability.
2026-01-22 12:18:39 +01:00