-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
526ce7c
commit 312ab08
Showing
1 changed file
with
32 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,41 @@ | ||
import React, { useEffect } from 'react' | ||
import React from 'react'; | ||
|
||
const CheckBoxForm = (props) => { | ||
|
||
|
||
const handleChange = (event,key) => { | ||
if(event.target.checked && key=="massEdit"){ | ||
props.setMassEditCheck(true); | ||
props.setBulkAddCheck(false) | ||
}else{ | ||
props.setBulkAddCheck(true) | ||
} | ||
const handleBulkChange = () => { | ||
props.setBulkAddCheck(true); | ||
props.setMassEditCheck(false); | ||
}; | ||
|
||
const handleBulkChange = (event,key) => { | ||
if(event.target.checked && key=="bulk"){ | ||
props.setBulkAddCheck(true); | ||
props.setMassEditCheck(false) | ||
}else{ | ||
props.setMassEditCheck(true) | ||
|
||
} | ||
const handleMassEditChange = () => { | ||
props.setBulkAddCheck(false); | ||
props.setMassEditCheck(true); | ||
}; | ||
|
||
|
||
|
||
|
||
|
||
return ( | ||
<> | ||
<div className="d-flex"> | ||
<div className="mr-3"> | ||
<input type="checkbox" id="scales" name="scales" checked={props.bulkcheck} onChange={(e)=>handleBulkChange(e,'bulk')} /> | ||
<label for="scales">{props.bulkAdd}</label> | ||
</div> | ||
|
||
<div className="ml-3"> | ||
<input type="checkbox" id="scales" name="scales" checked={props.masscheck} onChange={(e)=>handleChange(e,"massEdit")} /> | ||
<label for="scales">{props.massEdit} </label> | ||
</div> | ||
</div> | ||
</> | ||
) | ||
} | ||
<div className="d-flex"> | ||
<div className="mr-3"> | ||
<input | ||
type="radio" | ||
id="bulk" | ||
name="option" | ||
checked={props.bulkcheck} | ||
onChange={handleBulkChange} | ||
/> | ||
<label htmlFor="bulk">{props.bulkAdd}</label> | ||
</div> | ||
|
||
<div className="ml-3"> | ||
<input | ||
type="radio" | ||
id="massEdit" | ||
name="option" | ||
checked={!props.bulkcheck} | ||
onChange={handleMassEditChange} | ||
/> | ||
<label htmlFor="massEdit">{props.massEdit}</label> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CheckBoxForm; | ||
|
||
|