|
6 | 6 | Autocomplete, |
7 | 7 | Button, |
8 | 8 | FormLabel, |
| 9 | + FormHelperText, |
9 | 10 | IconButton, |
10 | 11 | InputAdornment, |
11 | 12 | Table, |
@@ -97,41 +98,51 @@ const ReimbursementProductTable: React.FC<ReimbursementProductTableProps> = ({ |
97 | 98 | {uniqueWbsElementsWithProducts.get(key)?.map((product, index) => ( |
98 | 99 | <ListItem key={product.index}> |
99 | 100 | <Box sx={{ display: 'flex', flexDirection: 'row' }}> |
100 | | - <Controller |
101 | | - name={`reimbursementProducts.${product.index}.name`} |
102 | | - control={control} |
103 | | - render={({ field }) => ( |
104 | | - <TextField |
105 | | - {...field} |
106 | | - label={'Description'} |
107 | | - autoComplete="off" |
108 | | - size={'small'} |
109 | | - variant={'outlined'} |
110 | | - sx={{ width: '50%', marginRight: '4px' }} |
111 | | - error={!!errors.reimbursementProducts?.[product.index]?.name} |
112 | | - /> |
113 | | - )} |
114 | | - /> |
115 | | - <Controller |
116 | | - name={`reimbursementProducts.${product.index}.cost`} |
117 | | - control={control} |
118 | | - render={({ field }) => ( |
119 | | - <TextField |
120 | | - {...field} |
121 | | - label={'Cost'} |
122 | | - size={'small'} |
123 | | - variant={'outlined'} |
124 | | - type="number" |
125 | | - autoComplete="off" |
126 | | - InputProps={{ |
127 | | - startAdornment: <InputAdornment position="start">$</InputAdornment> |
128 | | - }} |
129 | | - onBlur={(e) => onCostBlurHandler(parseFloat(e.target.value), product.index)} |
130 | | - sx={{ width: '50%' }} |
131 | | - error={!!errors.reimbursementProducts?.[product.index]?.cost} |
132 | | - /> |
133 | | - )} |
134 | | - /> |
| 101 | + <div style={{ display: 'flex', flexDirection: 'column', width: '50%', marginRight: '4px' }}> |
| 102 | + <Controller |
| 103 | + name={`reimbursementProducts.${product.index}.name`} |
| 104 | + control={control} |
| 105 | + render={({ field }) => ( |
| 106 | + <TextField |
| 107 | + {...field} |
| 108 | + label={'Description'} |
| 109 | + autoComplete="off" |
| 110 | + size={'small'} |
| 111 | + variant={'outlined'} |
| 112 | + sx={{ width: '100%' }} |
| 113 | + error={!!errors.reimbursementProducts?.[product.index]?.name} |
| 114 | + /> |
| 115 | + )} |
| 116 | + /> |
| 117 | + <FormHelperText error> |
| 118 | + {errors.reimbursementProducts?.[product.index]?.name?.message} |
| 119 | + </FormHelperText> |
| 120 | + </div> |
| 121 | + <div style={{ display: 'flex', flexDirection: 'column', width: '50%' }}> |
| 122 | + <Controller |
| 123 | + name={`reimbursementProducts.${product.index}.cost`} |
| 124 | + control={control} |
| 125 | + render={({ field }) => ( |
| 126 | + <TextField |
| 127 | + {...field} |
| 128 | + label={'Cost'} |
| 129 | + size={'small'} |
| 130 | + variant={'outlined'} |
| 131 | + type="number" |
| 132 | + autoComplete="off" |
| 133 | + InputProps={{ |
| 134 | + startAdornment: <InputAdornment position="start">$</InputAdornment> |
| 135 | + }} |
| 136 | + onBlur={(e) => onCostBlurHandler(parseFloat(e.target.value), product.index)} |
| 137 | + sx={{ width: '100%' }} |
| 138 | + error={!!errors.reimbursementProducts?.[product.index]?.cost} |
| 139 | + /> |
| 140 | + )} |
| 141 | + /> |
| 142 | + <FormHelperText error> |
| 143 | + {errors.reimbursementProducts?.[product.index]?.cost?.message} |
| 144 | + </FormHelperText> |
| 145 | + </div> |
135 | 146 | <IconButton onClick={() => removeProduct(product.index)}> |
136 | 147 | <Delete /> |
137 | 148 | </IconButton> |
|
0 commit comments