Skip to content

Commit

Permalink
Changes in frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
areyeslo committed Dec 5, 2024
1 parent c37fa2e commit 21c4ac6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ export const FinalSupplyEquipmentSummary = ({ data }) => {
)
const columns = useMemo(
() => [
{
headerName: t(
'finalSupplyEquipment:finalSupplyEquipmentColLabels.organization'
),
field: 'organization'
},
{
headerName: t(
'finalSupplyEquipment:finalSupplyEquipmentColLabels.supplyFromDate'
Expand Down
38 changes: 37 additions & 1 deletion frontend/src/views/FinalSupplyEquipments/_schema.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import i18n from '@/i18n'
import { actions, validation } from '@/components/BCDataGrid/columns'
import moment from 'moment'
import { CommonArrayRenderer } from '@/utils/grid/cellRenderers'
import { StandardCellErrors } from '@/utils/grid/errorRenderers'
import { StandardCellWarningAndErrors, StandardCellErrors } from '@/utils/grid/errorRenderers'
import { apiRoutes } from '@/constants/routes'

export const finalSupplyEquipmentColDefs = (
Expand Down Expand Up @@ -39,6 +39,42 @@ export const finalSupplyEquipmentColDefs = (
cellDataType: 'text',
hide: true
},
{
field: 'organization',
headerComponent: RequiredHeader,
headerName: i18n.t(
'finalSupplyEquipment:finalSupplyEquipmentColLabels.organization'
),
cellEditor: AutocompleteCellEditor,
cellRenderer: (params) =>
params.value ||
(!params.value && <Typography variant="body4">Select</Typography>),
cellEditorParams: {
options: optionsData?.organizations?.sort() || [],
multiple: false,
disableCloseOnSelect: false,
freeSolo: true,
openOnFocus: true,
},
cellStyle: (params) =>
StandardCellWarningAndErrors(params, errors),
suppressKeyboardEvent,
minWidth: 260,
editable: true,
valueGetter: (params) => {
return params.data?.organization || '';
},
valueSetter: (params) => {
if (params.newValue) {
const isValidOrganization = optionsData?.organizations.includes(params.newValue);

params.data.organization = isValidOrganization ? params.newValue : params.newValue;
return true;
}
return false;
},
tooltipValueGetter: (params) => "Select the organization from the list"
},
{
field: 'supplyFrom',
headerName: i18n.t(
Expand Down

0 comments on commit 21c4ac6

Please sign in to comment.