Commit Graph
1643 Commits
Author SHA1 Message Date
Jepp9350 91520e1b54 Refactor booking wash certificate handling logic
Replaced `wash_certificate_store` with `pdf_store` for handling wash certificate operations. Enhanced error handling with booking status checks (pending, completed, or cancelled) and added validation for wash certificate URL existence. This improves code clarity and ensures better consistency in managing wash certificates.
2025-03-26 12:08:27 +01:00
Jepp9350 87251ee445 Add branding support to departments and related routes
This commit introduces changes to include branding information in departments. Updates were made to routes, forms, and objects to handle branding IDs and enforce validation. Additionally, a method call was added to track object changes when branding is updated.
2025-03-26 11:39:30 +01:00
Jepp9350 4deef9dc09 Add branding feature with form, route, and object implementations
Introduced a new branding functionality, including a `branding_o` object, `create_branding_f` form, and associated routes in `BrandingRoute`. Refactored the forms directory for better organization and added support for branding in departments. Extended validation, object handling, and response handling to accommodate this new feature.
2025-03-26 11:04:12 +01:00
Jepp9350 6f36dc230a Add wash certificate email functionality with attachments
Integrates a new method to send wash certificate emails, including support for attaching PDFs. Updates the email system to handle attachments and streamlines booking processes to send certificates upon completion.
2025-03-25 19:10:04 +01:00
Jepp9350 54940e7cd7 Add wash certificate generation feature and refine booking logic
Introduces a form for generating wash certificates associated with bookings, along with validations and access restrictions. Refactors booking management to integrate a new `bookings_new_o` class, enhancing structure and adding functionalities like caching and detailed error handling.
2025-03-25 18:40:42 +01:00
Jepp9350 78928a6c1b Add interior wash booking form and enhanced form validation
Introduce `BOOK_INTERIOR_WASH` functionality with new input fields, setup, and email confirmations in the booking process. Refactor form validation to include advanced field metadata, conditional display logic, and stricter validation requirements. Implement reusable methods for field requirement checks, sanitization, and dynamic metadata handling for better form management.
2025-03-25 13:09:34 +01:00
Jepp9350 82a6349218 Add booking confirmation email functionality
Implemented a new booking confirmation email template and its integration with email sending functionality. Updated form handling to trigger confirmation email after submission and enhanced error handling on department validation.
2025-03-24 14:40:22 +01:00
Jepp9350 ef6f009ad9 Add support for customer number in form submissions
Introduced a new `customer_number` property across the form handling codebase, enabling forms to store and manage customer numbers where applicable. Updated methods to handle this property, including sanitization, validation, and saving processes. Added a `beforeSave` method to set `customer_number` during form submission.
2025-03-24 11:35:06 +01:00
Jepp9350 7976b89fff Add form field options handling and invoice discount logic
Added support for defining and retrieving form field options, along with methods to manage field-specific configurations. Enhanced invoice draft generation to handle discounts, including the ability to calculate total discounts and display them as separate lines. These updates improve flexibility in forms and invoice processing.
2025-03-24 10:27:11 +01:00
Jepp9350 45328a6b72 Add PDF generation module with HTML2PDF integration.
This commit introduces a new PDF generation module leveraging the HTML2PDF library. The module generates PDFs from HTML templates, supports customization through styles and templates, and integrates with Minio for storage and retrieval. A test route is added for generating and serving PDFs dynamically.
2025-03-14 14:56:55 +01:00
Jepp9350 b95215677a Add spipu/html2pdf and tecnickcom/tcpdf dependencies
Updated composer.json to include spipu/html2pdf for HTML to PDF conversion and its dependency tecnickcom/tcpdf. Adjusted composer.lock to reflect the updated dependency tree for these additions.
2025-03-14 09:34:02 +01:00
Jepp9350 ac6976cb43 Refactor Slack message formatting for new bookings.
Updated the message format to simplify content, translate to Danish, and remove unnecessary fields. This improves clarity and aligns with localized conventions.
2025-03-13 15:23:31 +01:00
Jeppe B 965bdf55fe Merge pull request #14 from copenhagentruckwash/development
Refactor and enhance order invoices and data handling
2025-03-13 14:39:04 +01:00
Jepp9350 411b11365d Refactor orderInvoicesRoute to clean up unused code.
Removed commented-out code snippets for better readability and maintainability. This streamlines the logic by eliminating unused query modifications and debug artifacts.
2025-03-13 14:36:17 +01:00
Jepp9350 32f0a1548f Add customer-specific filtering and refactor order invoice logic
Introduced customer attribute-based filtering for individual invoicing and enhanced collected order invoice processing with proper associations to customers and orders. Added new endpoints, fields, and utility methods to streamline data retrieval, ensure consistency, and support new use cases like 'Ready to Invoice'. Includes minor fixes, validations, and optimizations throughout the affected modules.
2025-03-13 14:35:49 +01:00
Jepp9350 f045611794 Add form handling system for dynamic form operations
Implemented a robust form management system with validation, sanitization, and database integration. Added reusable traits, classes, and methods to define, submit, and process forms. Introduced a "Book a Wash" form as an example implementation.
2025-03-12 14:35:21 +01:00
Jepp9350 aa07219b7a Add method to retrieve customer payment terms number
Introduced `getPaymentTermsNumber` method in the customer helper to fetch payment terms directly from the customer object. Refactored invoice drafts endpoint to use this method, ensuring cleaner and more reliable access to payment terms data.
2025-03-10 16:48:32 +01:00
Jepp9350 48ad281baa Add notifications module with routes, types, and helpers
Introduced a complete notifications module, including classes for managing notifications (`notifications_o`), traits for handling types and routing, and API routes to list, add, and delete notifications. Added input validation, permission handling, and JSON data processing capabilities.
2025-03-10 13:11:44 +01:00
Jepp9350 fdb536ea3e Add user data to collected order invoices array
Include customer user data in the collected order invoices payload by retrieving user information based on customer number. This ensures that relevant user details are available for further processing or integration.
2025-03-07 16:45:12 +01:00
Jepp9350 b3c4e9696f Refactor invoice handling and add total net amount calculation
Introduce logic for validating booked and draft invoices in E-conomic. Add methods to calculate the total net amount for invoice collections and improve error handling for specific invoice states. Updated related workflows to ensure consistent validation and data integrity.
2025-03-07 16:22:14 +01:00
Jepp9350 d160ecbb63 Add min and max fields to product options
This commit introduces support for `min` and `max` fields in product options. It includes backend changes to handle validation, setting, and retrieval of these new fields, ensuring compatibility. Additionally, a new `requireTypeIn` utility and `TYPE_NULL` constant were added for improved type validation.
2025-03-07 12:29:45 +01:00
Jepp9350 370760fbd3 Normalize data types for user prices and product attributes
Updated user price overrides and product attributes to enforce consistent data types. This improves data handling clarity and reduces type-related errors across the application.
2025-03-07 11:23:50 +01:00
Jepp9350 cc23c83aaf Add support for adding notes to order items.
Extended the `addItemToOrder` method to accept an optional `notes` parameter and updated relevant logic to handle it. Modified input validation in `orderItemsRoute` to ensure notes are a valid string. Adjusted `set_name` in `product_options_o` to handle empty strings by nullifying the name.
2025-03-06 16:05:14 +01:00
Jepp9350 02a5b811bc Add support for 'requires_note' property in products module
Introduced a new 'requires_note' property to the product object, including its initialization, serialization, and integration in relevant routes. This change ensures the property can be set, retrieved, and properly processed in API requests. It also updates logging to capture changes to this field when editing products.
2025-03-06 14:49:33 +01:00
Jepp9350 2038547d1c Enhance department report handling with date support
Added date parameter support for department daily reports, including validation, new functions, and route updates. Improved functionality allows fetching or creating reports for specific dates and prevents duplicate entries for the same date. Introduced a standardized date format within the API.
2025-03-06 14:37:32 +01:00
Jepp9350 9e7984b93a Cast department_id to integer in orders object
Ensure department_id is explicitly cast to an integer to prevent potential data type issues. This change improves type consistency and ensures reliability when processing order data.
2025-03-06 11:19:09 +01:00
Jepp9350 ec9f760bea Add user key management routes and enforce user context checks
Introduced GET and POST routes for managing user key-value pairs, restricted for administrative use. Added strict user context verification in `user_key_value_pairs_o` methods to ensure valid `user_id` is selected before operations. This enhances security and maintains data integrity for user-related actions.
2025-03-05 13:44:30 +01:00
Jepp9350 0d87b7acdd Add product option deletion functionality
Implemented endpoint and logic for deleting product options, ensuring user authentication, parameter validation, and proper logging. Added a delete method in the product options object to permanently remove records.
2025-03-05 11:54:17 +01:00
Jepp9350 a02729d5c6 Add module action handling and license plate lookup logging
Implemented `module_action_t` trait to standardize module actions with validation, logging, and execution. Added `module_action_logs_o` for logging module actions and integrated `license_plate_lookup_a` in motorapi for license plate lookup requests. Enhanced error handling to log failed actions and provide detailed feedback.
2025-03-05 11:11:09 +01:00
Jepp9350 cb62c66e5b Add earnings calculation and enhance department data handling
Introduced a method to calculate department earnings on a given date. Enhanced department object with new properties (dimension, created_at, updated_at) and improved data serialization for flexibility. Updated routes to accommodate these additions for more robust department insights.
2025-03-04 16:23:13 +01:00
Jepp9350 d6ed51f9ba Add endpoint to fetch the latest department daily report
Introduced a new method in `department_daily_reports_o` to select the latest daily report for a department. Added a corresponding API route to fetch the latest report details for a given department ID, with appropriate validations and access control measures. Adjusted parameter handling logic to enhance request validation.
2025-03-04 15:19:40 +01:00
Jepp9350 bf4879e593 Enhance product options and invoice data handling
Added support for `name`, `created_at`, and `updated_at` fields in product options API response for better data visibility. Updated invoice object logic to conditionally set draft and booked IDs based on `external_id`, improving flexibility and accuracy in handling external integrations.
2025-03-04 14:04:46 +01:00
Jepp9350 4d593c2b17 Add department daily reports feature and improve product handling
Introduced functionality for managing department daily reports, including endpoints for creating, updating, listing, and viewing product sales data. Enhanced product handling in reports by adding support for water usage, notes, and detailed product sales metrics. These changes improve tracking and reporting accuracy across departments.
2025-03-04 11:39:38 +01:00
Jepp9350 9d005566cc Refactor permissions and add department daily reports feature
Updated customer search route permission for clarity and introduced new functionality to manage and retrieve department daily reports. Added `department_daily_reports_o` object and associated route for handling reports, including permission checks, logging, and support for pagination.
2025-03-04 08:32:49 +01:00
Jepp9350 8928cd375a Add booked_invoice_id property and optimize invoice handling
Introduce the booked_invoice_id property in collected_order_invoices_o for improved invoice management. Optimize performance by avoiding redundant requests to external systems when the booked_invoice_id is already set. Enhance routes to include the booked_invoice_id in relevant responses and ensure a consistent structure for associated data.
2025-03-04 08:24:33 +01:00
Jepp9350 bad6a62a5a Add closed_at field to order serialization
The `closed_at` field is now included when serializing order data. This provides additional context regarding the closure state of invoices in the order, enhancing data accessibility and utility.
2025-03-03 17:24:12 +01:00
Jepp9350 9e46140373 Add support for handling economic invoice drafts/booked IDs
Added methods to check and retrieve economic invoice draft and booked IDs, improving invoice tracking functionality. Introduced a new method in the economic endpoint to fetch booked invoice details using external IDs. Additionally, updated the object property class to handle integer values during SQL updates.
2025-03-03 16:55:09 +01:00
Jepp9350 68b3fd2171 Add customer detail accessors and update usage in endpoints
Added individual getter methods for customer details such as name, email, address, zip code, city, and country in the economic_customer module. Updated the invoices drafts endpoint to use these accessors instead of directly accessing properties. Included an exception throw for failed requests in the endpoint.
2025-03-03 16:00:23 +01:00
Jepp9350 2042f0c00a Add capability to sync collected invoices to E-Conomic
Introduced a new endpoint for syncing collected order invoices with E-Conomic via a POST route. Added methods for creating, managing, and closing invoice drafts in E-Conomic. The implementation includes validations, external ID handling, and seamless integration of payment terms and layout configurations.
2025-03-03 15:36:58 +01:00
Jepp9350 dc419e1715 Remove unused MotorAPI license plate lookup endpoint
The `/modules/motorapi/lookup` route has been removed as it is no longer needed. This cleanup reduces codebase clutter and eliminates outdated or redundant functionality.
2025-03-03 12:18:36 +01:00
Jepp9350 b66c598f83 Add external ID generation and update user route actions
Introduce methods to generate and retrieve unique external IDs for collected order invoices, ensuring UUID-based uniqueness. Update user route actions to include new functionalities for editing user roles and passwords.
2025-03-03 10:58:55 +01:00
Jepp9350 e9aeedc327 Add invoice collection assignment logic to orders and users
Introduced methods to manage, assign, and retrieve invoice collections for orders and users. Enhanced the system to support flexible invoice grouping, including per-order logic and automated assignment to open or newly created invoice collections.
2025-02-28 13:50:27 +01:00
Jepp9350 9bf0355e47 Add routes and objects for managing collected order invoices
Introduced GET and POST endpoints for collected order invoices, enabling listing and creation functionalities for authorized users. Added a new database object to handle invoice-related operations and validations. Included utility functions to enforce parameter requirements and data integrity.
2025-02-28 12:07:46 +01:00
Jepp9350 7497e0c744 Fix undefined filter check in db_object_t trait logic
Ensure the filter is set before validating its value against allowed options. This prevents potential undefined index errors when filters are not provided.
2025-02-28 11:04:22 +01:00
Jepp9350 72df11e345 Simplify permission handling in group addition.
Removed unnecessary array key access for permissions in the loop. This improves code readability and ensures the permission object is directly passed without intermediate referencing.
2025-02-28 09:30:25 +01:00
Jepp9350 2fca599599 Add role cloning functionality and adjust permission methods.
Introduced a method to clone groups with their permissions and added a corresponding API endpoint for role cloning. Adjusted existing permission methods to ensure consistent behavior and naming, swapping the implementation of add/remove permissions. Improved permission fetching logic for cleaner data handling.
2025-02-28 09:27:06 +01:00
Jepp9350 491f268108 Add role and permission management with enhanced access control
This update introduces functionalities for managing roles, permissions, and access control across departments. Key additions include methods for filtering, restricting, and handling user permissions, as well as new APIs for assigning/removing permissions to/from roles. Access to resources like orders, bookings, and plate scans is now securely tied to department-specific permissions.
2025-02-27 17:54:18 +01:00
Jepp9350 d430f6ff7f Add support for related item ID in order items
Enhanced the order items functionality to include a related item ID. This involved adding a new property, updating methods to handle the related item ID, and ensuring appropriate validation and sanitation in the API routes. Also improved input sanitization for motorapi lookups to prevent SQL injection risks.
2025-02-25 18:06:57 +01:00
Jepp9350 8b4187295c Handle token retrieval from JSON body in authentication.
Added support for extracting the token from JSON-formatted request bodies (`php://input`). This ensures compatibility with clients sending tokens in the request payload alongside other existing methods.
2025-02-24 11:59:35 +01:00
Jepp9350 b6a345edb2 Handle token authentication using POST parameters.
Previously, only tokens from headers or GET parameters were accepted. This update adds support for tokens sent via POST parameters, ensuring compatibility with more request types and improving flexibility for clients.
2025-02-24 11:18:03 +01:00