-
Notifications
You must be signed in to change notification settings - Fork 7
feat: disable fields for agreement edit form #4794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements field disabling functionality for the agreement edit form based on agreement status. When an agreement is awarded, certain fields (name, contract type, service requirement type, product service code, procurement shop, agreement reason, requesting agency, and servicing agency) become immutable and are visually disabled with explanatory tooltips. Super users retain the ability to edit these fields even on awarded agreements.
Key changes include:
- Backend logic to return immutable fields list based on agreement awarded status
- Frontend form components updated to support disabled states with tooltips
- Helper function to determine field disablement based on user role and field status
- Comprehensive E2E tests to verify field disabling behavior for regular users and super users
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/models/agreements.py | Added conditional logic to immutable_awarded_fields property to return empty list when agreement is not awarded |
| backend/ops_api/tests/ops/agreement/test_agreement_immutable_awarded_fields.py | Updated all tests to create awarded procurement actions before asserting immutable fields behavior |
| frontend/src/components/UI/Form/Input/Input.jsx | Added isDisabled and tooltipMsg props with conditional rendering for disabled state; removed PropTypes |
| frontend/src/components/UI/Form/Select/Select.jsx | Added isDisabled and tooltipMsg props with conditional rendering for disabled state and tooltip |
| frontend/src/components/UI/Form/ComboBox/ComboBox.jsx | Added isDisabled and tooltipMsg props with conditional rendering for disabled ComboBox |
| frontend/src/components/Agreements/ProductServiceCodeSelect.jsx | Added isDisabled and tooltipMsg props with conditional rendering for disabled select |
| frontend/src/components/Agreements/AgreementReasonSelect.jsx | Added isDisabled and tooltipMsg props with conditional rendering for disabled fieldset and select |
| frontend/src/components/ServicesComponents/ContractTypeSelect/ContractTypeSelect.jsx | Added isDisabled prop and removed PropTypes |
| frontend/src/components/ServicesComponents/ServiceReqTypeSelect/ServiceReqTypeSelect.jsx | Added isDisabled and tooltipMsg props and removed PropTypes |
| frontend/src/components/Agreements/AgencySelect/AgencySelect.jsx | Added isDisabled and tooltipMsg props to pass through to ComboBox |
| frontend/src/components/Agreements/AgreementEditor/AgreementEditForm.jsx | Applied field disabling logic to all immutable awarded fields using isFieldDisabled helper |
| frontend/src/components/Agreements/AgreementEditor/AgreementEditForm.hooks.js | Extracted immutable_awarded_fields from agreement metadata and added super user check to procurement shop disabling |
| frontend/src/components/Agreements/AgreementEditor/AgreementEditForm.helpers.js | New helper file with isFieldDisabled function to determine field disablement based on field type, immutable fields list, and user role |
| frontend/src/pages/agreements/agreements.constants.js | Added Name field to AgreementFields enum |
| frontend/src/pages/agreements/details/AgreementDetailsEdit.test.js | Updated mock agreement data to include _meta.immutable_awarded_fields property |
| frontend/cypress/e2e/editAgreement.cy.js | Added comprehensive E2E tests for awarded agreement field disabling and super user override behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
What changed
This PR implements field disabling functionality for the agreement edit form based on agreement status. When an agreement is awarded, certain fields (name, contract type, service requirement type, product service code, procurement shop, agreement reason, requesting agency, and servicing agency) become immutable and are visually disabled with explanatory tooltips. Super users retain the ability to edit these fields even on awarded agreements.
Key changes include:
Backend logic to return immutable fields list based on agreement awarded status
Frontend form components updated to support disabled states with tooltips
Helper function to determine field disablement based on user role and field status
Comprehensive E2E tests to verify field disabling behavior for regular users and super users
Issue
How to test
Definition of Done Checklist