選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

OrganizationSearchForm.js 5.4 KiB

2年前
2年前
1年前
2年前
1年前
2年前
1年前
2年前
2年前
1年前
2年前
1年前
2年前
1年前
2年前
1年前
2年前
2年前
1年前
2年前
2年前
2年前
1年前
2年前
2年前
2年前
1年前
2年前
2年前
2年前
1年前
2年前
2年前
2年前
1年前
1年前
2年前
1年前
2年前
2年前
2年前
1年前
2年前
2年前
2年前
1年前
2年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. // material-ui
  2. import {
  3. Button,
  4. CardContent,
  5. Grid, TextField,
  6. Typography,
  7. Checkbox, FormControlLabel,
  8. } from '@mui/material';
  9. import MainCard from "../../../components/MainCard";
  10. import { useForm } from "react-hook-form";
  11. import { useState } from "react";
  12. import * as React from "react";
  13. import * as UrlUtils from "../../../utils/ApiPathConst";
  14. import * as HttpUtils from "../../../utils/HttpUtils";
  15. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  16. const OrganizationSearchForm = ({ applySearch }) => {
  17. const [type, setType] = useState([]);
  18. const { reset, register, handleSubmit } = useForm()
  19. const onSubmit = (data) => {
  20. let typeArray = [];
  21. for (let i = 0; i < type.length; i++) {
  22. typeArray.push(type[i].label);
  23. }
  24. const temp = {
  25. brNo: data.brNo,
  26. enCompanyName: data.enCompanyName,
  27. chCompanyName: data.chCompanyName,
  28. searchCreditor: data.searchCreditor
  29. };
  30. applySearch(temp);
  31. };
  32. function resetForm() {
  33. setType([]);
  34. reset();
  35. }
  36. const doExport=()=>{
  37. HttpUtils.fileDownload({
  38. url: UrlUtils.GET_ORG_EXPORT
  39. });
  40. }
  41. return (
  42. <MainCard xs={12} md={12} lg={12}
  43. border={false}
  44. content={false}>
  45. <form onSubmit={handleSubmit(onSubmit)}>
  46. {/*row 1*/}
  47. <CardContent sx={{ px: 2.5, pt: 3 }}>
  48. <Grid item justifyContent="space-between" alignItems="center">
  49. <Typography variant="h4">Search Form</Typography>
  50. </Grid>
  51. </CardContent>
  52. {/*row 2*/}
  53. <Grid container alignItems={"center"}>
  54. <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}>
  55. <TextField
  56. fullWidth
  57. {...register("brNo")}
  58. id='brNo'
  59. label="BR No."
  60. InputLabelProps={{
  61. shrink: true
  62. }}
  63. />
  64. </Grid>
  65. <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}>
  66. <TextField
  67. fullWidth
  68. {...register("enCompanyName")}
  69. id="enCompanyName"
  70. label="Name (English)"
  71. InputLabelProps={{
  72. shrink: true
  73. }}
  74. />
  75. </Grid>
  76. <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}>
  77. <TextField
  78. fullWidth
  79. {...register("chCompanyName")}
  80. id="chCompanyName"
  81. label="Name (Chinese)"
  82. InputLabelProps={{
  83. shrink: true
  84. }}
  85. />
  86. </Grid>
  87. <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3}}>
  88. <FormControlLabel
  89. {...register("searchCreditor")}
  90. control={<Checkbox/>}
  91. label="Search Creditor Only"
  92. id="searchCreditor"
  93. />
  94. </Grid>
  95. </Grid>
  96. {/*last row*/}
  97. <Grid container maxWidth justifyContent="flex-end">
  98. <Grid item sx={{ ml: 3, mr: 3, mb: 3, mt: 3 }}>
  99. <Button
  100. size="large"
  101. variant="contained"
  102. onClick={doExport}
  103. sx={{
  104. textTransform: 'capitalize',
  105. alignItems: 'end'
  106. }}>
  107. <Typography variant="h5">Export</Typography>
  108. </Button>
  109. </Grid>
  110. <Grid item sx={{ ml: 3, mr: 3, mb: 3, mt: 3 }}>
  111. <Button
  112. size="large"
  113. variant="contained"
  114. onClick={resetForm}
  115. sx={{
  116. textTransform: 'capitalize',
  117. alignItems: 'end'
  118. }}>
  119. <Typography variant="h5">Clear</Typography>
  120. </Button>
  121. </Grid>
  122. <Grid item sx={{ ml: 3, mr: 3, mb: 3, mt: 3 }}>
  123. <Button
  124. size="large"
  125. variant="contained"
  126. type="submit"
  127. sx={{
  128. textTransform: 'capitalize',
  129. alignItems: 'end'
  130. }}>
  131. <Typography variant="h5">Submit</Typography>
  132. </Button>
  133. </Grid>
  134. </Grid>
  135. </form>
  136. </MainCard>
  137. );
  138. };
  139. export default OrganizationSearchForm;