Skip to content

Commit

Permalink
Merge branch 'release-0.2.0' into fix/prashanth-workflow-caching
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaselhan authored Dec 12, 2024
2 parents c2864ec + 390f6f1 commit 60af6aa
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
12 changes: 12 additions & 0 deletions frontend/src/views/OtherUses/AddEditOtherUses.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ export const AddEditOtherUses = () => {
) {
const ciOfFuel = findCiOfFuel(params.data, optionsData)
params.node.setDataValue('ciOfFuel', ciOfFuel)

// Auto-populate the "Unit" field based on the selected fuel type
if (params.colDef.field === 'fuelType') {
const fuelType = optionsData?.fuelTypes?.find(
(obj) => params.data.fuelType === obj.fuelType
);
if (fuelType && fuelType.units) {
params.node.setDataValue('units', fuelType.units);
} else {
params.node.setDataValue('units', '');
}
}
}
},
[optionsData]
Expand Down
28 changes: 15 additions & 13 deletions frontend/src/views/OtherUses/_schema.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,22 @@ export const otherUsesColDefs = (optionsData, errors) => [
{
field: 'units',
headerName: i18n.t('otherUses:otherUsesColLabels.units'),
headerComponent: RequiredHeader,
cellEditor: AutocompleteCellEditor,
minWidth: '155',
cellEditorParams: {
options: optionsData.unitsOfMeasure.map((obj) => obj),
multiple: false,
disableCloseOnSelect: false,
freeSolo: false,
openOnFocus: true
cellEditor: 'agSelectCellEditor',
cellEditorParams: (params) => {
const fuelType = optionsData?.fuelTypes?.find(
(obj) => params.data.fuelType === obj.fuelType
);
const values = fuelType ? [fuelType.units] : [];
return {
values: values
};
},
suppressKeyboardEvent,
cellRenderer: (params) =>
params.value || <BCTypography variant="body4">Select</BCTypography>,
cellStyle: (params) => StandardCellErrors(params, errors)
cellRenderer: (params) => {
return params.value ? params.value : <BCTypography variant="body4">Select</BCTypography>;
},
cellStyle: (params) => StandardCellErrors(params, errors),
editable: true,
minWidth: 100
},
{
field: 'ciOfFuel',
Expand Down

0 comments on commit 60af6aa

Please sign in to comment.