-
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.
Merge pull request #4 from openimis/feature/OM-84
OM-84: voucher acquirement page init, method pciker
- Loading branch information
Showing
6 changed files
with
139 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import React, { useState } from 'react'; | ||
|
||
import { | ||
Divider, | ||
Grid, | ||
Paper, | ||
Typography, | ||
} from '@material-ui/core'; | ||
import { makeStyles } from '@material-ui/styles'; | ||
|
||
import { useModulesManager, useTranslations } from '@openimis/fe-core'; | ||
import { MODULE_NAME } from '../constants'; | ||
import VoucherAcquirementMethodPicker from '../pickers/VoucherAcquirementMethodPicker'; | ||
|
||
export const useStyles = makeStyles((theme) => ({ | ||
paper: { ...theme.paper.paper, margin: '10px 0 0 0' }, | ||
paperHeaderTitle: theme.paper.title, | ||
tableTitle: theme.table.title, | ||
item: theme.paper.item, | ||
fullHeight: { | ||
height: '100%', | ||
}, | ||
})); | ||
|
||
function VoucherAcquirementForm() { | ||
const modulesManager = useModulesManager(); | ||
const classes = useStyles(); | ||
const { formatMessage } = useTranslations(MODULE_NAME, modulesManager); | ||
const [acquirementMethod, setAcquirementMethod] = useState(null); | ||
|
||
return ( | ||
<Grid container> | ||
<Grid xs={12}> | ||
<Paper className={classes.paper}> | ||
<Grid xs={12}> | ||
<Grid> | ||
<Typography className={classes.paperHeaderTitle}> | ||
{formatMessage('workerVoucher.menu.voucherAcquirement')} | ||
</Typography> | ||
</Grid> | ||
</Grid> | ||
<Divider /> | ||
<Grid className={classes.item}> | ||
<Typography> | ||
{formatMessage('workerVoucher.VoucherAcquirementForm.subtitle')} | ||
</Typography> | ||
</Grid> | ||
<Divider /> | ||
<Grid container> | ||
<Grid item xs={3} className={classes.item}> | ||
<VoucherAcquirementMethodPicker | ||
label="workerVoucher.acquirement.method" | ||
nullLabel="workerVoucher.acquirement.method.NONE" | ||
acquirementMethod={acquirementMethod} | ||
setAcquirementMethod={setAcquirementMethod} | ||
required | ||
withNull | ||
withLabel | ||
/> | ||
</Grid> | ||
</Grid> | ||
<Divider style={{ margin: '12px 0' }} /> | ||
</Paper> | ||
</Grid> | ||
</Grid> | ||
); | ||
} | ||
|
||
export default VoucherAcquirementForm; |
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
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
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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
|
||
import { ConstantBasedPicker } from '@openimis/fe-core'; | ||
import { ACQUIREMENT_METHOD_LIST } from '../constants'; | ||
|
||
function VoucherAcquirementMethodPicker({ | ||
label, | ||
acquirementMethod, | ||
setAcquirementMethod, | ||
required, | ||
withNull, | ||
readOnly = false, | ||
nullLabel, | ||
withLabel, | ||
}) { | ||
return ( | ||
<ConstantBasedPicker | ||
module="workerVoucher" | ||
constants={ACQUIREMENT_METHOD_LIST} | ||
value={acquirementMethod} | ||
onChange={(method) => setAcquirementMethod(method)} | ||
label={label} | ||
required={required} | ||
withNull={withNull} | ||
readOnly={readOnly} | ||
nullLabel={nullLabel} | ||
withLabel={withLabel} | ||
/> | ||
); | ||
} | ||
|
||
export default VoucherAcquirementMethodPicker; |
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