Created
May 11, 2020 10:46
-
-
Save thinhbg2812/483ca416f2dfd31ac8b1d643012c310a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const SharePriceCalculator = (props: any): JSX.Element => { | |
| const classes = useStyles() | |
| const sharePriceInput = Math.floor(props.original_price / props.share_number) | |
| return <TextInput label="Giá 1 phần" initialValue={sharePriceInput} value={sharePriceInput} source="share_price" className={classes.width256} /> | |
| } | |
| const PropertyEdit = (props: any) => { | |
| const classes = useStyles() | |
| return ( | |
| <Edit {...props}> | |
| <SimpleForm redirect="show"> | |
| <NumberInput source="original_price" formClassName={classes.inlineBlock} step={1000000} validate={validateRequired} /> | |
| <NumberInput source="share_number" formClassName={classes.ilb_ml32} step={1} validate={validateRequired} /> | |
| <NumberInput source="deposit" className={classes.width544} step={100000} validate={validateRequired} /> | |
| <NumberInput source="interest" className={classes.width544} step={1} validate={validateRequired} /> | |
| <FormDataConsumer formClassName={classes.inlineBlock} > | |
| { | |
| ({ formData, ...rest }: any) => <SharePriceCalculator {...formData} /> | |
| } | |
| </FormDataConsumer> | |
| </SimpleForm> | |
| </Edit> | |
| ) | |
| } | |
| export default PropertyEdit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment