Skip to content

Commit 94206dc

Browse files
Merge pull request #9 from ArthurPedroti/feat/switch-to-radio-otherdetails
Feat/switch to radio otherdetails
2 parents 9c5a10c + 00d9786 commit 94206dc

File tree

10 files changed

+937
-95
lines changed

10 files changed

+937
-95
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
REACT_APP_SERVER=http://192.168.2.63:3333
1+
REACT_APP_SERVER=https://192.168.2.250/

_redirects

Lines changed: 0 additions & 1 deletion
This file was deleted.

commitlint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
};

package.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pv-agf-frontend",
3-
"version": "0.9.61",
3+
"version": "0.9.62",
44
"private": true,
55
"dependencies": {
66
"@date-io/date-fns": "^2.4.0",
@@ -64,6 +64,10 @@
6464
]
6565
},
6666
"devDependencies": {
67+
"@commitlint/cli": "^9.0.1",
68+
"@commitlint/config-conventional": "^9.0.1",
69+
"commitizen": "^4.1.2",
70+
"cz-conventional-changelog": "3.2.0",
6771
"eslint": "^6.8.0",
6872
"eslint-config-airbnb": "^18.1.0",
6973
"eslint-config-prettier": "^6.11.0",
@@ -72,6 +76,18 @@
7276
"eslint-plugin-prettier": "^3.1.3",
7377
"eslint-plugin-react": "^7.19.0",
7478
"eslint-plugin-react-hooks": "^2.5.0",
79+
"husky": "^4.2.5",
7580
"prettier": "^2.0.5"
81+
},
82+
"husky": {
83+
"hooks": {
84+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
85+
"prepare-commit-msg": "exec < /dev/tty && git cz --hook || true"
86+
}
87+
},
88+
"config": {
89+
"commitizen": {
90+
"path": "./node_modules/cz-conventional-changelog"
91+
}
7692
}
7793
}

src/components/PdfMakeDefault.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/PdfMakeKit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export default function PdfMakeKit({
223223
: null;
224224

225225
const engate = values.engate === true ? 'SIM' : 'NÃO';
226-
const contrato = values.contrato === true ? 'SIM' : 'NÃO';
226+
const contrato = values.contrato === 'sim' ? 'SIM' : 'NÃO';
227227
const pontExtraFormated = pontExtraFormat();
228228
const formattedProducts = productsFormat(produtos);
229229
const formattedPayments = paymentsFormat(parcelas);

src/components/PdfMakeMonofio.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/pages/ClientDetails/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ let ClientDetails = ({
7474
}
7575
}
7676

77-
function ClientSelect(values) {
78-
if (values !== undefined) {
79-
if (values.clientType === 'seller') {
77+
function ClientSelect(clientValues) {
78+
if (clientValues !== undefined) {
79+
if (clientValues.clientType === 'seller') {
8080
return (
8181
<WindowedSelect
8282
options={clientList}

src/pages/OtherDetails/index.js

Lines changed: 55 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -8,62 +8,68 @@ import Button from '@material-ui/core/Button';
88

99
import { bindActionCreators } from 'redux';
1010

11+
import { Form } from 'antd';
1112
import TextField from '@material-ui/core/TextField';
12-
13+
import Radio from '@material-ui/core/Radio';
14+
import RadioGroup from '@material-ui/core/RadioGroup';
1315
import FormControlLabel from '@material-ui/core/FormControlLabel';
14-
import Switch from '@material-ui/core/Switch';
16+
import { useCallback } from 'react';
1517
import { Creators as SelectActions } from '../../store/ducks/select_infos';
1618

1719
import Menu from '../../components/Menu';
1820

19-
const renderDate = ({ input, label, type }) => (
20-
<div>
21-
<TextField
22-
{...input}
23-
label={label}
24-
fullWidth
25-
type={type}
26-
InputLabelProps={{ shrink: true }}
27-
margin="normal"
28-
size="small"
29-
/>
30-
</div>
31-
);
32-
33-
const renderInput = ({ input, label }) => (
34-
<div>
35-
<TextField
36-
{...input}
37-
label={label}
38-
fullWidth
39-
margin="normal"
40-
size="small"
41-
/>
42-
</div>
43-
);
21+
let OtherDetails = ({ history, handleSubmit, submitting }) => {
22+
const showResults = useCallback(
23+
() => {
24+
history.push('/confirm');
25+
},
26+
[history],
27+
);
4428

45-
const renderSwitch = ({ input, label }) => (
46-
<div>
47-
<FormControlLabel
48-
control={(
49-
<Switch
29+
const renderDate = useCallback(
30+
({ input, label, type }) => (
31+
<div>
32+
<TextField
5033
{...input}
51-
checked={!!input.value}
52-
onChange={input.onChange}
53-
value="checked"
54-
color="primary"
34+
label={label}
35+
fullWidth
36+
type={type}
37+
InputLabelProps={{ shrink: true }}
38+
margin="normal"
39+
size="small"
5540
/>
56-
)}
57-
labelPlacement="start"
58-
label={label}
59-
/>
60-
</div>
61-
);
41+
</div>
42+
),
43+
[],
44+
);
6245

63-
let OtherDetails = ({ history, handleSubmit, submitting }) => {
64-
async function showResults() {
65-
history.push('/confirm');
66-
}
46+
const renderInput = useCallback(({ input, label }) => (
47+
<div>
48+
<TextField
49+
{...input}
50+
label={label}
51+
fullWidth
52+
margin="normal"
53+
size="small"
54+
/>
55+
</div>
56+
),
57+
[]);
58+
59+
const radioButton = useCallback(({ input, ...rest }) => (
60+
<RadioGroup row {...input} {...rest} value={input.value || 'não'}>
61+
<FormControlLabel
62+
value="nao"
63+
control={<Radio />}
64+
label="Não"
65+
/>
66+
<FormControlLabel
67+
value="sim"
68+
control={<Radio />}
69+
label="Sim"
70+
/>
71+
</RadioGroup>
72+
), []);
6773

6874
return (
6975
<div>
@@ -72,12 +78,11 @@ let OtherDetails = ({ history, handleSubmit, submitting }) => {
7278
<Container maxWidth="md" component="main" align="center">
7379
<form onSubmit={handleSubmit(showResults)}>
7480
<Container maxWidth="sm" align="left">
75-
<Field
76-
name="contrato"
81+
<Form.Item
7782
label="Com contrato?"
78-
type="text"
79-
component={renderSwitch}
83+
style={{ fontWeight: 500, marginBottom: 0 }}
8084
/>
85+
<Field name="contrato" component={radioButton} />
8186
<Field
8287
name="num_contrato"
8388
label="Nº Contrato:"

0 commit comments

Comments
 (0)