Skip to content

Commit

Permalink
fix: updated old headlines to be current for units/removed hardcoded …
Browse files Browse the repository at this point in the history
…date/ fixed validity date validation
  • Loading branch information
SPageot committed Feb 9, 2022
1 parent 2f47c85 commit 73e6bfd
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 25 deletions.
1 change: 1 addition & 0 deletions src/components/blocks/DateSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const DateSelect = ({
<LocalizationProvider dateAdapter={DateAdapter}>
<DatePicker
label="Select time"
format="MM/DD/YYYY"
value={dateValue}
onChange={newValue => {
if (newValue) {
Expand Down
19 changes: 14 additions & 5 deletions src/components/forms/CreateUnitsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const CreateUnitsForm = withRouter(({ onClose, left, top, width, height }) => {
marketplaceIdentifier: '',
unitTags: '',
unitStatusReason: '',
vintageYear: 2020,
vintageYear: '',
unitRegistryLink: '',
unitType: '',
unitStatus: '',
Expand Down Expand Up @@ -152,7 +152,7 @@ const CreateUnitsForm = withRouter(({ onClose, left, top, width, height }) => {
if (!_.isEmpty(newLabels) && tabValue === 1) {
if (newLabels.length > 0) {
setLabelFormsValid([]);
let labelFormValid = newLabels.map(async label => {
_.map(newLabels, async label => {
const validLabel = await labelSchema.isValid(label);
return setLabelFormsValid(prev => [...prev, validLabel]);
});
Expand All @@ -164,7 +164,6 @@ const CreateUnitsForm = withRouter(({ onClose, left, top, width, height }) => {
return setTabValue(prev => prev + 1);
}
}
console.log(labelFormValid);
}

labelRef.current();
Expand Down Expand Up @@ -574,7 +573,12 @@ const CreateUnitsForm = withRouter(({ onClose, left, top, width, height }) => {
options={selectUnitTypeOptions}
selected={
newUnits.unitType
? [{ value: newUnits.unitType, label: newUnits.unitType }]
? [
{
value: newUnits.unitType,
label: newUnits.unitType,
},
]
: undefined
}
onChange={selectedOptions =>
Expand Down Expand Up @@ -761,7 +765,12 @@ const CreateUnitsForm = withRouter(({ onClose, left, top, width, height }) => {
options={selectUnitStatusOptions}
selected={
newUnits.unitStatus
? [{ label: newUnits.unitStatus, value: newUnits.unitStatus }]
? [
{
label: newUnits.unitStatus,
value: newUnits.unitStatus,
},
]
: undefined
}
onChange={selectedOptions =>
Expand Down
13 changes: 4 additions & 9 deletions src/components/forms/LabelsValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,14 @@ export const labelSchema = yup.object().shape({
.required('Required Field'),
creditingPeriodEndDate: yup
.date()
.min(
yup.ref('creditingPeriodStartDate'),
"End date can't be before start date",
)
.typeError('Invalid Date')
.required('Required Field'),
validityPeriodStartDate: yup.string().required('Required Field'),
validityPeriodStartDate: yup
.date()
.typeError('Invalid Date')
.required('Required Field'),
validityPeriodEndDate: yup
.date()
.min(
yup.ref('validityPeriodStartDate'),
"End date can't be before start date",
)
.typeError('Invalid Date')
.required('Required Field'),
unitQuantity: yup
Expand Down
21 changes: 10 additions & 11 deletions src/pages/Units/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,22 @@ import {
} from '../../components';

const headings = [
'projectLocationId',
'unitOwner',
'countryJurisdictionOfOwner',
'inCountryJurisdictionOfOwner',
'serialNumberBlock',
'unitIdentifier',
'unitType',
'intendedBuyerOrgUid',
'serialNumberPattern',
'marketplace',
'tags',
'unitStatus',
'unitTransactionType',
'unitStatusReason',
'tokenIssuanceHash',
'marketplaceLink',
'marketplaceIdentifier',
'unitsIssuanceLocation',
'unitTags',
'unitStatusReason',
'vintageYear',
'unitRegistryLink',
'unitMarketplaceLink',
'cooresponingAdjustmentDeclaration',
'unitType',
'unitStatus',
'correspondingAdjustmentDeclaration',
'correspondingAdjustmentStatus',
];

Expand Down

0 comments on commit 73e6bfd

Please sign in to comment.