do not ask user for currency scale
This commit is contained in:
@@ -6,7 +6,6 @@ import {Button, Select, TextInput} from "react-materialize";
|
|||||||
const ChipSelection = (props) => {
|
const ChipSelection = (props) => {
|
||||||
const [chips, setChips] = useState([]);
|
const [chips, setChips] = useState([]);
|
||||||
const [selectedChip, setSelectedChip] = useState('1');
|
const [selectedChip, setSelectedChip] = useState('1');
|
||||||
const [chipScale, setChipScale] = useState('2');
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async() => {
|
(async() => {
|
||||||
@@ -26,7 +25,7 @@ const ChipSelection = (props) => {
|
|||||||
const chipsToOptions = chips.map( (chip, index) => <option key={index} value={chip.id}>{`${chip.code} • ${chip.name}`}</option>);
|
const chipsToOptions = chips.map( (chip, index) => <option key={index} value={chip.id}>{`${chip.code} • ${chip.name}`}</option>);
|
||||||
|
|
||||||
const disableSubmit = () => {
|
const disableSubmit = () => {
|
||||||
return !((parseInt(selectedChip) > 0) && (parseInt(chipScale) > 0));
|
return !(parseInt(selectedChip) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
@@ -37,7 +36,7 @@ const ChipSelection = (props) => {
|
|||||||
chip_code: chipData.code,
|
chip_code: chipData.code,
|
||||||
chip_symbol: chipData.symbol,
|
chip_symbol: chipData.symbol,
|
||||||
chip_prefixed: chipData.prefixed,
|
chip_prefixed: chipData.prefixed,
|
||||||
chip_scale: parseInt(chipScale)
|
chip_scale: chipData.scale
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
@@ -61,14 +60,6 @@ const ChipSelection = (props) => {
|
|||||||
{ chipsToOptions }
|
{ chipsToOptions }
|
||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
<TextInput
|
|
||||||
id='chipScale'
|
|
||||||
label="Chip scale"
|
|
||||||
value={chipScale}
|
|
||||||
type='number'
|
|
||||||
onChange={(e) => setChipScale(e.target.value)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button disabled={disableSubmit()} waves="light" onClick={handleSubmit}>
|
<Button disabled={disableSubmit()} waves="light" onClick={handleSubmit}>
|
||||||
Do It
|
Do It
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user