Skip to content

Commit

Permalink
Doing something
Browse files Browse the repository at this point in the history
  • Loading branch information
mansoor-sajjad committed Nov 14, 2023
1 parent 8899e11 commit 7a085ac
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 33 deletions.
47 changes: 47 additions & 0 deletions src/screens/common/components/SelectSupplier.js
Original file line number Diff line number Diff line change
@@ -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 (
<SelectField
id="select-supplier"
floatingLabelFixed={true}
style={{ minWidth: 350 }}
floatingLabelText={'Provider'}
onChange={(e, k, v) => 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 (
<MenuItem
key={supplier.id}
value={supplier.id}
label={supplier.name}
primaryText={
<span
style={{
color: isLevel1Provider ? 'intial' : '#d9a51b'
}}
>
{supplier.name}
</span>
}
/>
);
})}
</SelectField>
);
};
Original file line number Diff line number Diff line change
@@ -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;
{
/*
<SelectSupplier
/>;
*/
}
};
4 changes: 4 additions & 0 deletions src/screens/geocoder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@ export default () => {
>
<Tab label="Geocoder pipeline" {...a11yProps(0)} />
<Tab label="OSM POI filter" {...a11yProps(1)} />
<Tab label="TariffZone/FareZone Import" {...a11yProps(2)} />
</Tabs>
<TabPanel value={value} index={0}>
<Pelias />
</TabPanel>
<TabPanel value={value} index={1}>
<OSMPOIFilter />
</TabPanel>
<TabPanel value={value} index={2}>
<OSMPOIFilter />
</TabPanel>
</div>
);
};
39 changes: 6 additions & 33 deletions src/screens/providers/components/SuppliersContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -121,39 +122,11 @@ class SuppliersContainer extends React.Component {
}}
>
<div style={{ display: 'flex', alignItems: 'center' }}>
<SelectField
id="select-supplier"
floatingLabelFixed={true}
style={{ minWidth: 350 }}
floatingLabelText={'Provider'}
onChange={(e, k, v) => 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 (
<MenuItem
key={supplier.id}
value={supplier.id}
label={supplier.name}
primaryText={
<span
style={{
color: isLevel1Provider ? 'intial' : '#d9a51b'
}}
>
{supplier.name}
</span>
}
/>
);
})}
</SelectField>
<SelectSupplier
suppliers={supplierItems}
selectSupplier={v => this.selectSupplier(v)}
selectedSupplierId={activeProviderId}
/>
{canEditOrganisation && (
<div
style={{
Expand Down

0 comments on commit 7a085ac

Please sign in to comment.