Skip to content

Commit

Permalink
fix: switched serial number and serial block positioning/fixed date i…
Browse files Browse the repository at this point in the history
…ssue
  • Loading branch information
SPageot committed Mar 8, 2022
1 parent 5aa8c60 commit 6359485
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/components/blocks/DateSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const DateSelect = ({
onChange={newValue => {
if (newValue) {
setDateValue(
formatDate(`${newValue.$M + 1}/${newValue.$D}/${newValue.$y}`),
formatDate(`${newValue.$M + 1}/${newValue.$D + 1}/${newValue.$y}`),
);
} else {
setDateValue(null);
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/CreateUnitIssuanceForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const CreateUnitIssuanceForm = ({ value, onChange }) => {
const intl = useIntl();
const { location } = useHistory();

const isUserOnUnitsPage = location.pathname.includes('units') ? true : false;
const isUserOnUnitsPage = location.pathname.includes('projects') ? true : false;

const areFieldsDisabled = useMemo(() => {
if (!isUserOnUnitsPage) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/CreateUnitLabelsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const CreateUnitLabelsForm = ({ value, onChange }) => {
const { pickLists } = useSelector(store => store.climateWarehouse);
const { location } = useHistory();

const isUserOnUnitsPage = location.pathname.includes('units') ? true : false;
const isUserOnUnitsPage = location.pathname.includes('projects') ? true : false;

const areFieldsDisabled = useMemo(() => {
if (!isUserOnUnitsPage) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/CreateUnitsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const CreateUnitsForm = withRouter(({ onClose, modalSizeAndPosition }) => {
const intl = useIntl();

const [unit, setUnit] = useState({
projectLocationId: 'test',
projectLocationId: '',
unitOwner: '',
countryJurisdictionOfOwner: '',
inCountryJurisdictionOfOwner: '',
Expand Down
33 changes: 16 additions & 17 deletions src/components/forms/UnitDetailsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,15 @@ const UnitDetailsForm = ({ unitDetails, setUnitDetails }) => {
</Body>
)}
</StyledFieldContainer>

<StyledFieldContainer>
<StyledLabelContainer>
<Body>
<LabelContainer>
*<FormattedMessage id="serial-number-block" />
*<FormattedMessage id="serial-number-pattern" />
</LabelContainer>
<ToolTipContainer
tooltip={intl.formatMessage({
id: 'units-serial-number-block-description',
id: 'units-serial-number-pattern-description',
})}>
<DescriptionIcon height="14" width="14" />
</ToolTipContainer>
Expand All @@ -194,39 +193,39 @@ const UnitDetailsForm = ({ unitDetails, setUnitDetails }) => {
<InputContainer>
<StandardInput
variant={
errorMessage?.serialNumberBlock
errorMessage?.serialNumberPattern
? InputVariantEnum.error
: undefined
}
size={InputSizeEnum.large}
placeholderText={intl.formatMessage({
id: 'serial-number-block',
id: 'serial-number-pattern',
})}
state={InputStateEnum.default}
value={unitDetails.serialNumberBlock}
value={unitDetails.serialNumberPattern}
onChange={value =>
setUnitDetails(prev => ({
...prev,
serialNumberBlock: value,
serialNumberPattern: value,
}))
}
/>
</InputContainer>
{errorMessage?.serialNumberBlock && (
{errorMessage?.serialNumberPattern && (
<Body size="Small" color="red">
{errorMessage.serialNumberBlock}
{errorMessage.serialNumberPattern}
</Body>
)}
</StyledFieldContainer>
<StyledFieldContainer>
<StyledLabelContainer>
<Body>
<LabelContainer>
*<FormattedMessage id="serial-number-pattern" />
*<FormattedMessage id="serial-number-block" />
</LabelContainer>
<ToolTipContainer
tooltip={intl.formatMessage({
id: 'units-serial-number-pattern-description',
id: 'units-serial-number-block-description',
})}>
<DescriptionIcon height="14" width="14" />
</ToolTipContainer>
Expand All @@ -235,27 +234,27 @@ const UnitDetailsForm = ({ unitDetails, setUnitDetails }) => {
<InputContainer>
<StandardInput
variant={
errorMessage?.serialNumberPattern
errorMessage?.serialNumberBlock
? InputVariantEnum.error
: undefined
}
size={InputSizeEnum.large}
placeholderText={intl.formatMessage({
id: 'serial-number-pattern',
id: 'serial-number-block',
})}
state={InputStateEnum.default}
value={unitDetails.serialNumberPattern}
value={unitDetails.serialNumberBlock}
onChange={value =>
setUnitDetails(prev => ({
...prev,
serialNumberPattern: value,
serialNumberBlock: value,
}))
}
/>
</InputContainer>
{errorMessage?.serialNumberPattern && (
{errorMessage?.serialNumberBlock && (
<Body size="Small" color="red">
{errorMessage.serialNumberPattern}
{errorMessage.serialNumberBlock}
</Body>
)}
</StyledFieldContainer>
Expand Down

0 comments on commit 6359485

Please sign in to comment.