diff --git a/frontend/src/views/FuelCodes/AddFuelCode/AddEditFuelCode.jsx b/frontend/src/views/FuelCodes/AddFuelCode/AddEditFuelCode.jsx
index 1e54f01bc..857b566b9 100644
--- a/frontend/src/views/FuelCodes/AddFuelCode/AddEditFuelCode.jsx
+++ b/frontend/src/views/FuelCodes/AddFuelCode/AddEditFuelCode.jsx
@@ -113,16 +113,6 @@ const AddEditFuelCodeBase = () => {
)
}
setRowData([transformedData])
- } else {
- setRowData([
- {
- id: uuid(),
- prefixId: 1,
- fuelSuffix: optionsData?.fuelCodePrefixes?.find(
- (item) => item.prefix === 'BCLCF'
- ).nextFuelCode
- }
- ])
}
}, [optionsData, existingFuelCode, isGridReady])
diff --git a/frontend/src/views/FuelExports/_schema.jsx b/frontend/src/views/FuelExports/_schema.jsx
index 60656d905..41021fe27 100644
--- a/frontend/src/views/FuelExports/_schema.jsx
+++ b/frontend/src/views/FuelExports/_schema.jsx
@@ -348,17 +348,20 @@ export const fuelExportColDefs = (optionsData, errors, gridReady) => [
isFuelCodeScenario && !params.data.fuelCode
if (fuelCodeRequiredAndMissing) {
- // If required and missing, force a red border
+ // Required scenario but missing a fuel code
style.borderColor = 'red'
+ style.backgroundColor = '#fff'
+ } else if (isFuelCodeScenario && fuelCodes.length > 1) {
+ style.backgroundColor = '#fff'
+ style.borderColor = 'unset'
+ } else if (isFuelCodeScenario && fuelCodes.length > 0) {
+ style.backgroundColor = '#fff'
+ style.borderColor = 'unset'
+ } else {
+ style.backgroundColor = '#f2f2f2'
}
- const conditionalStyle =
- fuelCodes.length > 0 &&
- isFuelCodeScenario &&
- !fuelCodeRequiredAndMissing
- ? { backgroundColor: '#fff', borderColor: 'unset' }
- : { backgroundColor: '#f2f2f2' }
- return { ...style, ...conditionalStyle }
+ return style
},
editable: (params) => {
const fuelTypeObj = optionsData?.fuelTypes?.find(
diff --git a/frontend/src/views/OtherUses/_schema.jsx b/frontend/src/views/OtherUses/_schema.jsx
index 401b6db61..af28e5126 100644
--- a/frontend/src/views/OtherUses/_schema.jsx
+++ b/frontend/src/views/OtherUses/_schema.jsx
@@ -60,14 +60,16 @@ export const otherUsesColDefs = (optionsData, errors) => [
cellEditorParams: (params) => {
const fuelType = optionsData?.fuelTypes?.find(
(obj) => params.data.fuelType === obj.fuelType
- );
+ )
return {
- options: fuelType ? fuelType.fuelCategories.map((item) => item.category) : [],
+ options: fuelType
+ ? fuelType.fuelCategories.map((item) => item.category)
+ : [],
multiple: false,
disableCloseOnSelect: false,
freeSolo: false,
openOnFocus: true
- };
+ }
},
suppressKeyboardEvent,
cellRenderer: (params) =>
@@ -153,22 +155,18 @@ export const otherUsesColDefs = (optionsData, errors) => [
const fuelCodeRequiredAndMissing =
isFuelCodeScenario && !params.data.fuelCode
- // If required and missing, show red border
if (fuelCodeRequiredAndMissing) {
+ // Required scenario but missing a fuel code
style.borderColor = 'red'
+ style.backgroundColor = '#fff'
+ } else if (isFuelCodeScenario && fuelCodes.length > 0) {
+ style.backgroundColor = '#fff'
+ style.borderColor = style.borderColor || 'unset'
+ } else {
+ style.backgroundColor = '#f2f2f2'
}
- const conditionalStyle =
- isFuelCodeScenario &&
- fuelCodes.length > 0 &&
- !fuelCodeRequiredAndMissing
- ? {
- backgroundColor: '#fff',
- borderColor: style.borderColor || 'unset'
- }
- : { backgroundColor: '#f2f2f2' }
-
- return { ...style, ...conditionalStyle }
+ return style
},
suppressKeyboardEvent,
minWidth: 150,
@@ -225,14 +223,18 @@ export const otherUsesColDefs = (optionsData, errors) => [
cellEditorParams: (params) => {
const fuelType = optionsData?.fuelTypes?.find(
(obj) => params.data.fuelType === obj.fuelType
- );
- const values = fuelType ? [fuelType.units] : [];
+ )
+ const values = fuelType ? [fuelType.units] : []
return {
values: values
- };
+ }
},
cellRenderer: (params) => {
- return params.value ? params.value : Select;
+ return params.value ? (
+ params.value
+ ) : (
+ Select
+ )
},
cellStyle: (params) => StandardCellErrors(params, errors),
editable: true,