diff --git a/frontend/src/views/FinalSupplyEquipments/FinalSupplyEquipmentSummary.jsx b/frontend/src/views/FinalSupplyEquipments/FinalSupplyEquipmentSummary.jsx index 84437a91b..81ce8415d 100644 --- a/frontend/src/views/FinalSupplyEquipments/FinalSupplyEquipmentSummary.jsx +++ b/frontend/src/views/FinalSupplyEquipments/FinalSupplyEquipmentSummary.jsx @@ -48,6 +48,12 @@ export const FinalSupplyEquipmentSummary = ({ data }) => { ) const columns = useMemo( () => [ + { + headerName: t( + 'finalSupplyEquipment:finalSupplyEquipmentColLabels.organization' + ), + field: 'organization' + }, { headerName: t( 'finalSupplyEquipment:finalSupplyEquipmentColLabels.supplyFromDate' diff --git a/frontend/src/views/FinalSupplyEquipments/_schema.jsx b/frontend/src/views/FinalSupplyEquipments/_schema.jsx index fb431246e..e082c1ace 100644 --- a/frontend/src/views/FinalSupplyEquipments/_schema.jsx +++ b/frontend/src/views/FinalSupplyEquipments/_schema.jsx @@ -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 = ( @@ -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 && Select), + 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(