From 7a085acc6eb36856850dbf742098995dbeed5d0c Mon Sep 17 00:00:00 2001 From: Mansoor Sajjad Date: Tue, 14 Nov 2023 12:32:47 +0100 Subject: [PATCH] Doing something --- .../common/components/SelectSupplier.js | 47 +++++++++++++++++++ .../tariffZonesImport/TariffZonesImport.js | 17 +++++++ src/screens/geocoder/index.js | 4 ++ .../components/SuppliersContainer.js | 39 +++------------ 4 files changed, 74 insertions(+), 33 deletions(-) create mode 100644 src/screens/common/components/SelectSupplier.js create mode 100644 src/screens/geocoder/components/tariffZonesImport/TariffZonesImport.js diff --git a/src/screens/common/components/SelectSupplier.js b/src/screens/common/components/SelectSupplier.js new file mode 100644 index 00000000..060354b2 --- /dev/null +++ b/src/screens/common/components/SelectSupplier.js @@ -0,0 +1,47 @@ +import SelectField from 'material-ui/SelectField'; +import MenuItem from 'material-ui/MenuItem'; +import React from 'react'; + +export const SelectSupplier = ({ + suppliers, + selectSupplier, + selectedSupplierId +}) => { + console.log(suppliers, selectSupplier, selectedSupplierId); + + return ( + selectSupplier(v)} + autoWidth={true} + value={Number(selectedSupplierId) || -1} + iconStyle={{ fill: 'rgba(22, 82, 149, 0.69)' }} + > + {suppliers.map(supplier => { + const isLevel1Provider = + (supplier.chouetteInfo && + supplier.chouetteInfo.migrateDataToProvider) || + supplier.id === -1; + return ( + + {supplier.name} + + } + /> + ); + })} + + ); +}; diff --git a/src/screens/geocoder/components/tariffZonesImport/TariffZonesImport.js b/src/screens/geocoder/components/tariffZonesImport/TariffZonesImport.js new file mode 100644 index 00000000..a640c726 --- /dev/null +++ b/src/screens/geocoder/components/tariffZonesImport/TariffZonesImport.js @@ -0,0 +1,17 @@ +import { SelectSupplier } from '../../../common/components/SelectSupplier'; +import { useSelector } from 'react-redux'; +import { useState } from 'react'; + +export const TariffZonesImport = () => { + const suppliers = useSelector(state => state.SuppliersReducer.data, []); + const [selectedSupplier, setSelectedSupplier] = useState(); + + return null; + { + /* + ; +*/ + } +}; diff --git a/src/screens/geocoder/index.js b/src/screens/geocoder/index.js index 7a47c9f7..9c425887 100644 --- a/src/screens/geocoder/index.js +++ b/src/screens/geocoder/index.js @@ -47,6 +47,7 @@ export default () => { > + @@ -54,6 +55,9 @@ export default () => { + + + ); }; diff --git a/src/screens/providers/components/SuppliersContainer.js b/src/screens/providers/components/SuppliersContainer.js index 03336d93..d5e61b1f 100644 --- a/src/screens/providers/components/SuppliersContainer.js +++ b/src/screens/providers/components/SuppliersContainer.js @@ -26,6 +26,7 @@ import rolesParser from 'roles/rolesParser'; import MdEdit from 'material-ui/svg-icons/image/edit'; import MdDelete from 'material-ui/svg-icons/action/delete-forever'; import ConfirmDialog from 'modals/ConfirmDialog'; +import { SelectSupplier } from '../../common/components/SelectSupplier'; class SuppliersContainer extends React.Component { constructor(props) { @@ -121,39 +122,11 @@ class SuppliersContainer extends React.Component { }} >
- this.selectSupplier(v)} - autoWidth={true} - value={Number(activeProviderId) || -1} - iconStyle={{ fill: 'rgba(22, 82, 149, 0.69)' }} - > - {supplierItems.map(supplier => { - const isLevel1Provider = - (supplier.chouetteInfo && - supplier.chouetteInfo.migrateDataToProvider) || - supplier.id === -1; - return ( - - {supplier.name} - - } - /> - ); - })} - + this.selectSupplier(v)} + selectedSupplierId={activeProviderId} + /> {canEditOrganisation && (