IO-233 Beging get vehicle makes

This commit is contained in:
Patrick Fic
2021-08-11 11:08:03 -07:00
parent 6b64499e24
commit fd7c907b8f
13 changed files with 408 additions and 75 deletions

View File

@@ -0,0 +1,43 @@
import React, { useState } from "react";
import { Modal, Button, Table } from "antd";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(mapStateToProps, mapDispatchToProps)(DmsCdkMakes);
export function DmsCdkMakes({ bodyshop, form, socket }) {
const [makesList, setMakesList] = useState([]);
const [loading, setLoading] = useState(false);
const [visible, setVisible] = useState(false);
return (
<div>
<Modal visible={visible} onCancel={() => setVisible(false)}>
{JSON.stringify(makesList, null, 2)}
<Table loading={loading} data={makesList} />
</Modal>
<Button
onClick={() => {
setVisible(true);
setLoading(true);
socket.emit(
"cdk-get-makes",
(bodyshop.cdk_dealerid,
(makes) => {
setMakesList(makes);
setLoading(false);
})
);
}}
>
Get Makes
</Button>
</div>
);
}