40 lines
912 B
JavaScript
40 lines
912 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import Form from 'react-bootstrap/Form';
|
|
|
|
export default function AgencySelect({
|
|
name, onChange, placeholder, rry, title,
|
|
}) {
|
|
if (rry.length > 0) {
|
|
return (
|
|
<Form.Select
|
|
aria-label="select table entries per page"
|
|
name={name}
|
|
id={name}
|
|
className={name}
|
|
onChange={onChange}
|
|
placeholder={placeholder}
|
|
defaultValue={placeholder}
|
|
title={title}
|
|
type="text"
|
|
required
|
|
>
|
|
{rry.map((item) => (
|
|
<option key={item.agency_id} value={item.agency_id}>
|
|
{item.agency_name}
|
|
</option>
|
|
))}
|
|
</Form.Select>
|
|
);
|
|
}
|
|
return <p>Loading...</p>;
|
|
}
|
|
|
|
AgencySelect.propTypes = {
|
|
name: PropTypes.string,
|
|
onChange: PropTypes.func,
|
|
title: PropTypes.string,
|
|
placeholder: PropTypes.string,
|
|
rry: PropTypes.array,
|
|
};
|