IO-233 Beging get vehicle makes
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user