Skip to content

Commit

Permalink
Merge branch 'main' into feat/1722-wcag-standards-to-log-in-screen
Browse files Browse the repository at this point in the history
  • Loading branch information
ngunner15 authored Nov 21, 2024
2 parents 57239b5 + 69c3e36 commit a3a474a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ interface SingleOwnerInfoProps {
setState: Function,
readOnly?: boolean,
isReview?: boolean
isOwnershipStep?: boolean
}

const SingleOwnerInfo = ({
ownerInfo, defaultAgency, defaultCode, fundingSourcesQuery,
methodsOfPaymentQuery, deleteAnOwner, checkPortionSum, setState, readOnly, isReview
methodsOfPaymentQuery, deleteAnOwner, checkPortionSum, setState,
readOnly, isReview, isOwnershipStep
}: SingleOwnerInfoProps) => {
const isReadOnly = readOnly && (isOwnershipStep || !isReview);
const [ownerPortionInvalidText, setOwnerPortionInvalidText] = useState<string>(
inputText.portion.invalidText
);
Expand Down Expand Up @@ -150,7 +153,7 @@ const SingleOwnerInfo = ({
locationCode: StringInputType
) => setClientAndCode(client, locationCode)
}
readOnly={readOnly && !isReview}
readOnly={isReadOnly}
/>
</Column>
<Column className={`single-owner-info-col ${colsClass}`} xs={4} sm={4} md={4} lg={4}>
Expand All @@ -168,7 +171,7 @@ const SingleOwnerInfo = ({
}}
invalid={ownerInfo.ownerPortion.isInvalid}
invalidText={ownerPortionInvalidText}
readOnly={readOnly && !isReview}
readOnly={isReadOnly}
/>
</Column>
<Column className={`single-owner-info-col ${colsClass}`} xs={4} sm={4} md={4} lg={4}>
Expand All @@ -188,7 +191,7 @@ const SingleOwnerInfo = ({
onWheel={(e: React.ChangeEvent<HTMLInputElement>) => e.target.blur()}
invalid={ownerInfo.reservedPerc.isInvalid}
invalidText={reservedInvalidText}
readOnly={readOnly && !isReview}
readOnly={isReadOnly}
/>
</div>
<div className="reserved-surplus-input">
Expand All @@ -206,7 +209,7 @@ const SingleOwnerInfo = ({
onWheel={(e: React.ChangeEvent<HTMLInputElement>) => e.target.blur()}
invalid={ownerInfo.surplusPerc.isInvalid}
invalidText={surplusInvalidText}
readOnly={readOnly && !isReview}
readOnly={isReadOnly}
/>
</div>
</div>
Expand All @@ -233,7 +236,7 @@ const SingleOwnerInfo = ({
onChange={(e: ComboBoxEvent) => handleFundingSource(e.selectedItem)}
invalid={ownerInfo.fundingSource.isInvalid}
invalidText={inputText.funding.invalidText}
readOnly={readOnly && !isReview}
readOnly={isReadOnly}
/>
)
}
Expand All @@ -258,7 +261,7 @@ const SingleOwnerInfo = ({
onChange={(e: ComboBoxEvent) => handleMethodOfPayment(e.selectedItem)}
invalid={ownerInfo.methodOfPayment.isInvalid}
invalidText={inputText.payment.invalidText}
readOnly={readOnly && !isReview}
readOnly={isReadOnly}
/>

)
Expand All @@ -276,6 +279,7 @@ const SingleOwnerInfo = ({
className="owner-mod-btn"
renderIcon={TrashCan}
onClick={() => deleteAnOwner(ownerInfo.id)}
disabled={isReadOnly}
>
Delete owner
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ const OwnershipStep = ({ isReview }: OwnershipStepProps) => {
}
readOnly={isFormSubmitted || originalSeedQty > 0}
isReview={isReview}
isOwnershipStep
/>
</AccordionItem>
))
Expand All @@ -235,6 +236,7 @@ const OwnershipStep = ({ isReview }: OwnershipStepProps) => {
className="owner-add-btn"
renderIcon={Add}
onClick={addAnOwner}
disabled={originalSeedQty > 0}
>
Add owner
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@carbon/icons-react';
import { Beforeunload } from 'react-beforeunload';

import { getSeedlotById, putAClassSeedlotProgress, getSeedlotFromOracleDbBySeedlotNumber } from '../../../api-service/seedlotAPI';
import { getSeedlotById, putAClassSeedlotProgress } from '../../../api-service/seedlotAPI';
import { THREE_HALF_HOURS, THREE_HOURS } from '../../../config/TimeUnits';
import getVegCodes from '../../../api-service/vegetationCodeAPI';
import Breadcrumbs from '../../../components/Breadcrumbs';
Expand Down Expand Up @@ -105,12 +105,6 @@ const SeedlotReviewContent = () => {
refetchOnMount: true
});

const getSeedlotBySeedlotNumberQuery = useQuery({
queryKey: ['seedlot-by-seedlotNumber', seedlotNumber],
queryFn: () => getSeedlotFromOracleDbBySeedlotNumber(seedlotNumber ?? ''),
enabled: seedlotQuery.isFetched
});

useEffect(() => {
const { status } = seedlotQuery;

Expand Down Expand Up @@ -556,8 +550,6 @@ const SeedlotReviewContent = () => {
className="edit-save-btn"
renderIcon={isReadMode ? Edit : Save}
onClick={handleEditSaveBtn}
disabled={getSeedlotBySeedlotNumberQuery.isSuccess
&& getSeedlotBySeedlotNumberQuery.data.data.originalSeedQty > 0}
>
{isReadMode ? 'Edit seedlot' : 'Save edit'}
</Button>
Expand Down

0 comments on commit a3a474a

Please sign in to comment.