Commit graph

648 commits

Author SHA1 Message Date
Ashwin
3a4ef40ba5 feat: Implement close-with-children dialog and related settings
- Added `close_with_children_dialog.dart` to handle the close ticket prompt with linked tickets.
- Updated `_closeWithChildren` method in `ticket_detail_screen.dart` to utilize the new dialog and respect organization settings for default checkbox state.
- Enhanced ticket closing feedback messages based on whether linked tickets were also closed.
- Introduced unit tests for `AccessToken` and `OrgSettings` to ensure proper serialization and functionality.
- Added tests for the new close-with-children dialog to verify UI behavior and settings integration.
- Updated existing tests to cover new functionality and ensure no regressions.
2026-08-08 01:18:27 +05:30
Ashwin
6bb00db95f feat: add reopen policy screen and related functionality
- Implemented ReopenScreen for managing the reopen policy, including admin-only access and editing capabilities.
- Added MenuRow for navigating to the Reopen policy settings in the SettingsHubScreen.
- Created unit tests for the ReopenPolicy model, covering JSON serialization and validation logic.
- Introduced BusinessCalendar model and tests for business hours functionality.
- Updated phone viewport tests to include scenarios for the reopen policy screen.
2026-08-08 00:33:39 +05:30
Ashwin
68554b89f6 Add escalation settings and tests for escalation policies
- Introduced a new menu option for 'Escalation' in the settings hub screen.
- Added tests for the escalation policies, including rendering, sorting, and behavior based on active/inactive states.
- Implemented logic to handle escalation policies in various scenarios, ensuring proper notifications and actions based on the policy configuration.
- Created unit tests to validate the functionality of escalation policies, including edge cases for targets and breach counts.
2026-08-08 00:11:15 +05:30
Ashwin
e9886b1d99 feat: add routing settings and implement routing rules tests
- Added a new menu option for routing settings in the settings hub screen.
- Implemented comprehensive tests for routing rules, covering various scenarios including rule creation, activation, deactivation, and condition handling.
- Introduced fake client for testing API interactions and ensured proper serialization of routing rules.
- Enhanced routing rule logic to handle active and inactive assignees correctly.
2026-08-07 23:46:49 +05:30
Ashwin
81e813bf3b feat: add tags management screen and functionality
- Introduced a new TagsScreen for managing tags across records.
- Implemented functionality for creating, turning off, turning on, and merging tags.
- Updated SettingsHubScreen to include a link to the new TagsScreen.
- Added tests for the TagsScreen to ensure proper rendering and functionality.
- Created unit tests for tag-related logic, including usage calculations and duplicate detection.
2026-08-07 23:06:14 +05:30
Ashwin
fc07d2a3bb chore: clean up code formatting and improve readability across multiple files 2026-08-07 22:42:57 +05:30
Ashwin
3f7d9068bf Refactor navigation links to use resolve function for path consistency
- Updated all task-related pages to use the `resolve` function for navigation links.
- Ensured that all links in the tickets and organization pages also utilize the `resolve` function.
- Removed unnecessary variables from OAuth callback handling in login server.
- Improved error handling in notifications API by clarifying empty body handling.
2026-08-07 22:31:31 +05:30
Ashwin
01ca6da166 Add unit tests for custom fields and macros functionality
- Implemented comprehensive tests for custom fields, covering key validation, draft validation, payload creation, and parsing.
- Added tests for macros, including permission checks, removal actions, draft validation, and payload structure.
- Established a fake HTTP client to simulate API responses for testing purposes.
- Ensured that all edge cases and expected behaviors are thoroughly validated in both custom fields and macros.
2026-08-07 20:11:01 +05:30
Ashwin
98c95e55b0 Add unit tests for invoice creation, notifications, and timesheet functionality
- Implement tests for contact billing rules in new_invoice_test.dart
- Validate line item payload structure and constraints in new_invoice_test.dart
- Create comprehensive tests for notifications provider in notifications_provider_test.dart
- Ensure correct handling of unread notifications and marking them as read
- Add tests for timesheet provider functionality in timesheet_provider_test.dart
- Verify time entry parsing, running timers, and week calculations
2026-08-07 19:32:32 +05:30
Ashwin
f30e30aa7e feat(tags): add merge functionality for tags
- Introduced TagsMergeView to handle merging of tags, allowing records from one tag to be moved to another and archiving the source tag.
- Updated URLs to include the new merge endpoint.
- Enhanced tag views and serializers to support merging operations.
- Added tests for the new merge functionality, ensuring proper behavior and error handling.
- Updated frontend to integrate the merge feature, including UI changes for suggesting tag merges and handling user interactions.
- Documented the merge functionality in the relevant API and frontend files.
2026-08-07 16:43:34 +05:30
Ashwin
bd79a7a4cc Refactor code style and improve error handling in analytics API
- Cleaned up admin.py by removing unnecessary dictionary wrapping for fields.
- Adjusted migration files to maintain consistent formatting and removed redundant lines.
- Updated models.py and tests to remove unnecessary blank lines and improve readability.
- Enhanced error handling in the analytics API to properly forward upstream status and messages.
- Added comprehensive tests for the analytics proxy to ensure correct status and body forwarding.
- Updated contributing guidelines to clarify the use of ruff for code style enforcement.
2026-08-07 15:58:35 +05:30
Ashwin
f4484eaf4b Refactor and enhance frontend URL handling
- Removed unused imports and cleaned up test files for better readability.
- Updated `FRONTEND_URL` handling in `crm/settings.py` to enforce absolute URL requirements in production environments, preventing dead links in emails.
- Added comprehensive tests for `FRONTEND_URL` validation to ensure it does not accept loopback addresses or non-absolute URLs outside of development.
- Improved documentation to clarify the purpose and requirements of `FRONTEND_URL` in the context of email links and deployment.
- Updated dependencies in `pyproject.toml` and `uv.lock` to include `ruff` for enhanced linting capabilities.
2026-08-07 15:23:43 +05:30
Ashwin
d886d9ada3 feat: add kanban board feature with board and lane management
- Introduced BoardScreen for kanban board functionality.
- Updated app router to include route for the board screen.
- Added UI components for creating and managing boards and lanes.
- Implemented card management within lanes, including adding, moving, and deleting cards.
- Enhanced tasks list screen with navigation to the board screen.
- Created unit tests for board provider to ensure correct functionality and API interactions.
2026-08-07 14:46:33 +05:30
Ashwin
d5a14d6514 feat: add TeamScreen for managing team members and roles
- Implemented TeamScreen to display active and deactivated team members.
- Added functionality to invite new members and manage roles (admin/member).
- Integrated error handling for API responses and loading states.
- Created reusable widgets for displaying member information and actions.

feat: enhance TasksListScreen with initial view filtering

- Modified TasksListScreen to accept an initial view parameter for filtering tasks.
- Implemented logic to apply filters based on dashboard badge taps.
- Updated UI to show active filters with clear options.

test: add unit tests for dashboard badge filters

- Created tests to verify the behavior of task and lead filters based on dashboard badges.
- Ensured correct API query parameters are sent for various filter scenarios.

test: add unit tests for team provider functionality

- Implemented tests for team provider to validate fetching and managing team members.
- Verified role changes, activation status updates, and invite functionality.
- Ensured proper handling of API responses, including error states.
2026-08-07 12:49:50 +05:30
Ashwin
eea82484e2 feat: add file attachment functionality to task and ticket detail screens
- Implemented file attachment upload feature in task detail screen.
- Added a new AttachFileButton widget for initiating file uploads.
- Created AttachmentTile widget to display uploaded files with icons based on file type.
- Enhanced ticket detail screen to include a new Files tab for viewing and uploading attachments.
- Introduced AttachmentUploadResult class to handle the result of file uploads.
- Added postMultipart method in ApiService for handling multipart file uploads.
- Implemented attachment upload logic in attachment_upload.dart service.
- Updated pubspec.yaml to include file_picker dependency for file selection.
- Added unit tests for attachment upload functionality to ensure reliability.
2026-08-07 11:03:06 +05:30
Ashwin
ab27ea85fd Refactor dashboard API response to reduce payload size and improve performance
- Removed serialization of full account, contact, lead, and opportunity objects from the dashboard API response.
- Added new fields for urgent counts, pipeline by stage, revenue metrics, hot leads, tasks, activities, and goal summary.
- Updated the context building logic to only include counts and essential data.

Enhance JWT signing key validation in settings

- Added a check to ensure the SECRET_KEY is at least 32 bytes for HS256 JWT signing.
- Introduced warnings for development environments when the key is shorter than required.

Update environment variable documentation

- Clarified the requirements for the SECRET_KEY in the environment variables documentation, emphasizing the minimum length for security.

Revise mobile app API configuration for self-hosting

- Updated the mobile app to allow self-hosting by using `--dart-define` for API_BASE_URL and GOOGLE_SERVER_CLIENT_ID.
- Ensured that the app enforces HTTPS in release builds to secure JWT transmission.

Implement entity lookup for task linking in mobile app

- Created a new EntityLookup model to handle task attachments to accounts, leads, opportunities, and tickets.
- Refactored task form screen to utilize the new lookup mechanism, improving the user experience by providing real-time loading states and error handling.

Add unit tests for new features and configurations

- Implemented unit tests for API configuration, entity lookup, and task link picker to ensure functionality and reliability.
2026-08-07 10:05:19 +05:30
Ashwin
1da98d92cf feat: add contacts list screen with search and pagination
- Implemented ContactsListScreen to display a list of contacts with search functionality.
- Added infinite scrolling to load more contacts as the user scrolls.
- Created a count strip to show the number of contacts loaded.
- Added error handling and retry functionality for loading contacts.
- Introduced a new ContactRow widget for displaying individual contact details.

refactor: enhance deal form unsaved changes detection

- Replaced manual unsaved changes checks with a baseline snapshot comparison.
- Updated the deal form to capture the initial state of the form for better change detection.
- Improved the handling of unsaved changes for various fields in the deal form.

refactor: update lead form unsaved changes detection

- Implemented baseline snapshot comparison for unsaved changes in the lead form.
- Enhanced the lead form to ensure all relevant fields are considered for change detection.

feat: add accounts and contacts menu items in settings

- Added new menu items for Accounts and Contacts in the MoreScreen for easier navigation.

refactor: update task forms to use account options provider

- Changed references from accountsProvider to accountOptionsProvider in task forms for consistency.

fix: improve auth service sign-out process

- Updated the sign-out method to notify the server of the sign-out while ensuring local state is cleared.

test: add unit tests for account and contact parsing

- Created tests to validate the parsing of account and contact data from API responses.
- Ensured that the parsing logic correctly handles nested structures and missing fields.
2026-08-07 09:20:28 +05:30
Ashwin
4767126e3d Merge branch 'master' of https://github.com/django-crm/Django-CRM into dev 2026-08-07 08:46:08 +05:30
Ashwin
8911551e2c feat: Implement unsaved changes guard in forms
- Added UnsavedChangesGuard widget to prevent accidental loss of unsaved changes when navigating away from forms.
- Integrated unsaved changes detection in TicketFormScreen and ProfileScreen.
- Updated TicketFormScreen to compare current form state against a baseline to track unsaved changes.
- Enhanced user experience by prompting for confirmation when attempting to leave a form with unsaved changes.
- Refactored ticket submission logic to ensure proper validation and error handling.
- Introduced TokenStorage service for secure storage of JWTs, migrating from SharedPreferences to FlutterSecureStorage.
- Updated AuthService to utilize TokenStorage for managing access and refresh tokens.
- Added unit tests for TokenStorage to ensure proper functionality and migration of tokens.
- Created tests for unsaved changes functionality to verify correct behavior in various scenarios.
2026-08-07 08:45:36 +05:30
Ashwin Kumar
873d97b751
Merge pull request #739 from Django-CRM/dev
Dev
2026-08-07 08:23:17 +05:30
Ashwin
c1fa72b667 feat: Implement organization creation feature
- Removed notification model and related exports.
- Added create organization functionality in AuthProvider and AuthService.
- Introduced OrgCreateScreen for organization creation with form validation.
- Updated routing to include organization creation and selection screens.
- Enhanced OrgSelectionScreen to allow users to create a new organization.
- Added tests for organization creation and validation logic.
2026-08-07 08:22:43 +05:30
Ashwin
1d2d8f24d9 feat: update currency handling across various components
- Enhanced the money formatting function to include organization-specific currency in goals, invoices, leads, and pipeline pages.
- Updated the display of financial figures to reflect the correct currency in the dashboard and deal forms.
- Improved the handling of foreign currency deals in the dashboard, ensuring they are displayed correctly without being filtered out.
- Added tests to verify that amounts are displayed in the correct currency and that the deal form initializes with the organization's currency.
2026-08-07 00:17:40 +05:30
Ashwin
4d2b67f7d8 feat: enhance solution detail screen with access control for editing and deleting
feat: add initial due date support in task form screen
fix: ensure completed tasks are displayed correctly in tasks list screen
fix: resolve layout issues in ticket detail screen buttons
fix: improve error messaging for network failures in API service
fix: handle organization data correctly in auth service
fix: update task row to prevent layout issues with dismissible actions
fix: ensure multi-select sheet buttons layout correctly
test: add tests for KPI cards in dashboard screen
test: add tests for deals filter sheet layout
test: add tests for solution detail screen access control
test: add tests for task create date functionality
test: add tests for task row dismissible behavior
test: add tests for tasks list screen behavior with completed tasks
test: add tests for API envelope handling
test: add tests for API service network failure handling
test: add tests for permissions logic
2026-08-06 23:35:54 +05:30
Ashwin
da86a8dcc0 Refactor lead and contact catalogues to respect user roles and permissions 2026-08-06 20:28:16 +05:30
Ashwin
39e22b03d0 Implement board creation API and enhance currency handling across frontend components 2026-08-05 22:37:50 +05:30
Ashwin Kumar
9c60192367
Merge pull request #738 from Django-CRM/dev
Refactor RLS context handling and improve security measures
2026-08-05 17:36:07 +05:30
Ashwin
78abf8acae Refactor RLS context handling and improve security measures
- Updated the `ORG_SCOPED_TABLES` to clarify the exclusion of `security_audit_log` and its implications for RLS policies.
- Added tests to ensure `security_audit_log` remains unexposed and verify the absence of RLS policies.
- Implemented tests for HSTS settings behind a TLS-terminating proxy to ensure proper header emission.
- Enhanced notification API tests to enforce RLS context during notification creation and access.
- Adjusted notification model tests to ensure RLS context is correctly applied for cross-tenant scenarios.
- Refined RLS context management in `conftest.py` to ensure proper session handling across tests.
- Removed deprecated Salesforce settings from the frontend and updated documentation to reflect changes in API behavior.
- Cleaned up environment variable documentation to clarify the impact of `TRUST_PROXY_SSL_HEADER` and other settings.
2026-08-05 17:35:37 +05:30
Ashwin Kumar
e415b86a60
Merge pull request #737 from Django-CRM/dev
Dev
2026-08-05 11:40:27 +05:30
Ashwin
7f3eacdcf2 Refactor lead and opportunity management:
- Updated lead pipeline and task pipeline models to enhance the is_default field's help text for clarity.
- Modified lead and opportunity email tasks to utilize frontend URLs instead of domain names for better link accuracy.
- Removed outdated Celery task tests for leads and opportunities.
- Streamlined permission checks across lead and opportunity views by introducing a unified is_org_admin function.
- Improved HTML templates for email notifications to ensure correct variable usage and link generation.
- Enhanced kanban view filtering logic to ensure proper access control for users based on their roles.
2026-08-05 11:39:52 +05:30
Ashwin
e5b6beb4ca Refactor permissions and remove unused settings
- Replaced custom admin check with `is_org_admin` in `custom_field_views.py`, `organization_views.py`, `user_views.py`, and `macros/views.py` for consistency and clarity.
- Removed the unused `_is_admin` function from `custom_field_views.py` and `macros/views.py`.
- Updated organization-related views to streamline admin checks and improve error handling.
- Removed `SWAGGER_ROOT_URL` and `GOOGLE_REDIRECT_URI` settings from `settings.py` as they were not utilized.
- Cleaned up Swagger parameters across various modules to remove the now-irrelevant `org` header.
- Adjusted documentation to reflect the removal of `GOOGLE_REDIRECT_URI` and clarify Google OAuth configuration.
- Added database indexes for `Order` and `OrderLineItem` models to improve query performance.
2026-08-05 09:11:11 +05:30
Ashwin
446ac0bdab Refactor URL patterns to use <uid:pk> for unique identifiers across leads, macros, opportunities, and tasks
- Updated URL patterns in leads, macros, opportunity, and tasks to replace <str:pk> with <uid:pk> for better clarity and consistency.
- Adjusted related views to ensure compatibility with the new URL structure.
- Enhanced frontend templates and server-side logic to accommodate changes in URL patterns.
- Improved documentation in tags and templates to clarify usage and functionality.
2026-08-05 08:25:02 +05:30
Ashwin
0e6d880187 Add tests for client links and attachment deletion authorization
- Introduced tests for frontend URL generation in `test_client_links.py` to ensure all links in emails are reachable and correctly formatted.
- Added authorization tests for deleting attachments in `test_attachment_delete_authz.py` for leads and opportunities, ensuring proper access control based on user roles and organization boundaries.
- Updated `LeadAttachmentView` and `OpportunityAttachmentView` to use `get_scoped_or_404` for safer object retrieval, preventing unauthorized access to attachments across organizations.
- Improved documentation regarding the organization API key and personal access tokens, clarifying their scopes and security implications.
- Enhanced frontend token management to support new scope enforcement, allowing users to specify access levels when creating tokens.
2026-08-05 07:02:40 +05:30
Ashwin
6a7e821eed Refactor import views and enhance comment authorization
- Updated `_read_upload` function to enforce file size limit based on actual bytes read instead of client-supplied Content-Length, preventing potential bypasses.
- Added comprehensive tests for import size cap to ensure proper enforcement against various client declarations.
- Introduced `test_approval_authz.py` to validate approval visibility based on case access rules, ensuring unauthorized members cannot view sensitive case information.
- Modified `CommentSerializer` to make `object_id` and `org` read-only, preventing unauthorized edits to comment targets and ownership.
- Enhanced lead import functionality to restrict access to admin and users with sales access, ensuring proper authorization for bulk lead creation.
- Updated task handling in `create_lead_from_file` to correctly impersonate the user during lead creation, preserving the audit trail.
- Added tests for lead upload functionality to verify proper handling of CSV imports, including checks for duplicate titles across organizations and handling of missing email fields.
2026-08-05 06:00:06 +05:30
Ashwin Kumar
ba249bedc1
Merge pull request #735 from xprnio/fix/docker-venv
fix: move venv outside of backend in dockerfile
2026-08-05 05:31:09 +05:30
Ashwin Kumar
c7b2b9750b
Merge pull request #736 from Django-CRM/dev
Refactor API views to improve parameter handling and validation
2026-08-05 05:29:09 +05:30
Ashwin
ef9157f163 Refactor API views to improve parameter handling and validation
- Replaced direct usage of `json.loads` for parsing parameters with dedicated validation functions (`payload_id_list`, `uuid_list_param`, `uuid_param`) across multiple views to enhance error handling and maintainability.
- Updated filtering logic in various views to ensure proper UUID handling for related entities (e.g., `assigned_to`, `teams`, `contacts`, etc.).
- Enhanced permission checks by adding `HasOrgContext` to user-related views to enforce organization context.
- Improved error handling in invoice creation tests to correctly assert permission denial responses.
- Streamlined query parameter processing in Kanban and list views to reduce redundancy and improve clarity.
2026-08-05 05:09:11 +05:30
Ragnar Laud
0cfd54d945
fix: move venv outside of backend in dockerfile
The venv's bin directory gets overwritten when the docker copies the
backend directory into the image. This moves the venv outside of the
backend so that it does not get overwritten.
2026-08-05 01:12:07 +07:00
Ashwin Kumar
4d96be4d95
Merge pull request #733 from Django-CRM/dev
Dev
2026-08-04 22:49:32 +05:30
Ashwin
8f64fbbb6f test: add regression tests for sla_breached case filter to ensure proper SQL generation 2026-08-04 22:49:04 +05:30
Ashwin
1817a6fe61 fix: resolve ambiguous column reference in case list filters 2026-08-04 22:48:55 +05:30
Ashwin
3faf6ee410 feat: enhance filtering across various pages
- Added filtering capabilities to the invoices estimates and recurring pages, displaying filtered list messages when applicable.
- Updated the leads page to include filtering for people and tags, ensuring the filter bar reflects the current state.
- Enhanced the pipeline page with filtering options, including support for board and list views, and improved the handling of parameters.
- Implemented filtering in the solutions page, ensuring the display of all articles regardless of filters applied.
- Improved task management pages to support filtering, including the ability to filter by priority and search terms.
- Updated ticket management to include filtering options for status, priority, and search, with appropriate messaging for filtered results.
- Introduced tests for board fields and presets to ensure compliance with backend filtering capabilities.
2026-08-04 22:48:47 +05:30
Ashwin Kumar
319a402082
Merge pull request #732 from Django-CRM/dev
feat(invoices): add new template creation page and update template li…
2026-08-04 17:56:34 +05:30
Ashwin
1ab7152376 feat(invoices): add new template creation page and update template list actions
- Updated the template list page to link to a new template creation page.
- Implemented a new server-side route for creating invoice templates, including form handling and validation.
- Created a new Svelte component for the template creation form, allowing users to input template details.
- Added admin-only checks to restrict access to template creation.
- Enhanced the template list page with informative disabled buttons for editing templates.

feat(leads): implement lead conversion functionality

- Added a new action to convert leads, creating associated accounts, contacts, and opportunities.
- Updated the lead detail page to include a form for converting leads, with appropriate UX hints.
- Enhanced the lead edit page to display conversion results and links to newly created records.

feat(tags): implement tag archiving and restoring functionality

- Added actions for archiving and restoring tags, with appropriate error handling.
- Updated the tags management page to include controls for archiving and restoring tags.
- Enhanced user feedback for tag actions, including error messages and confirmation prompts.

test: add stub for dynamic public environment variables

- Created a stub for SvelteKit's $env/dynamic/public to facilitate unit testing without a full build.
2026-08-04 17:55:52 +05:30
Ashwin Kumar
e7f4e300ba
Merge pull request #731 from Django-CRM/dev
Dev
2026-08-04 16:09:19 +05:30
Ashwin
86e13796fe feat: implement tag creation functionality with error handling in settings
feat: enhance tag management UI with form for adding new tags

feat: add approval rule management with create, update, deactivate, and delete actions

feat: improve ticket approval settings UI with form handling and error messages

feat: add timer management functionality in timesheet with stop timer action

chore: add Vitest configuration for server-side testing

fix: update development API URL in mobile configuration
2026-08-04 15:13:35 +05:30
Ashwin
24390478e0 Refactor notifications handling: replace SSE with polling mechanism
- Removed the `/api/notifications/stream/` endpoint and associated SSE logic.
- Updated `Bell.svelte` and `notifications.svelte.js` to implement polling for notifications every 45 seconds.
- Introduced connection pooling configuration in environment variables documentation.
- Updated production deployment documentation to recommend WSGI over ASGI for improved database connection management.
2026-08-04 00:18:17 +05:30
Ashwin
9e202325c8 Update integration documentation to replace MCP server with AI agents 2026-08-03 23:16:05 +05:30
Ashwin Kumar
2e2199c54f
Merge pull request #730 from Django-CRM/dev
Dev
2026-08-03 20:48:37 +05:30
Ashwin
880a894668 fix(docs): update Read the Docs URL to reflect the new documentation site 2026-08-03 20:40:44 +05:30
Ashwin
e3b5181b19 Refactor comments for clarity and consistency across multiple screens and services
- Updated comments in LeadsListScreen, MoreScreen, TaskDetailScreen, TaskFormScreen, TasksListScreen, TicketAnalyticsScreen, TicketDetailScreen, TicketsListScreen, ApiService, AuthService, CrashReporting, DealCard, TicketCard, MultiSelectSheet, KanbanColumn, StageStepper, TicketApprovalPanel, TicketPropertiesCard, and TicketTimePanel to improve readability and maintain a consistent style.
- Adjusted punctuation and phrasing for better flow and understanding.
2026-08-03 09:36:48 +05:30