import {connect} from 'react-redux';
import LeOnePage from '../../components/AdminPage/LeOne';
import {add_dialog_msg, scan_leone, clear_scan_leone, get_leone_list,add_scan_leone,del_leone, add_leone, edit_leone, io_cmd, clear_leone} from '../../actions';

const mapStateToProps = (state) => ({
	i18n: state.i18n,
	scanList: state.lists.leone.scanList,
	list: state.lists.leone.list,
	status: state.lists.leone.status,
	scanning: state.lists.leone.scanning
});

const mapDispatchToProps = (dispatch, ownProps) => ({
	showDialog: (msg = '') => {
		dispatch(add_dialog_msg(msg));
	},
	clearList: () => {
		dispatch(clear_leone);
	},
	scanLeOne: (data) => {
		dispatch(scan_leone(data));
	},
	clearScan: () => {
		dispatch(clear_scan_leone())
	},
	addScanLeOne: (data) => {
		dispatch(add_scan_leone(data));
	},
	getLeOneList: (showLoading = true) => {
		dispatch(get_leone_list(showLoading));
	},
	delLeOne: (data) => {
		dispatch(del_leone(data));
	},
	addLeOne: (data) => {
		dispatch(add_leone(data));
	},
	editLeOne: (data) => {
		dispatch(edit_leone(data));
	},
	runCmd: (data) => {
		dispatch(io_cmd(data));
	}
})

export default connect(mapStateToProps, mapDispatchToProps)(LeOnePage);