<commit_before>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { push } from 'react-router-redux';
import { createStructuredSelector } from 'reselect';
import { List, ListItem, makeSelectable } from 'material-ui/List';
import classnames from 'classnames';

import { loadCommandes, loadFournisseurs } from 'containers/Commande/actions';
import { selectCommandesRelais, selectCommandeId } from 'containers/Commande/selectors';
import IconButton from 'material-ui/IconButton';
import AddIcon from 'material-ui/svg-icons/content/add';
import EditIcon from 'material-ui/svg-icons/editor/mode-edit';
import RemoveIcon from 'material-ui/svg-icons/action/delete-forever';

import moment from 'moment';
import styles from './styles.css';

const SelectableList = makeSelectable(List);

class AdminRelaisCommandes extends Component {
  static propTypes = {
    commandes: PropTypes.object.isRequired,
    commandeId: PropTypes.string,
    loadCommandes: PropTypes.func.isRequired,
    loadFournisseurs: PropTypes.func.isRequired,
    pushState: PropTypes.func.isRequired,
    params: PropTypes.object.isRequired,
    children: PropTypes.node,
  }

  componentDidMount() {
    this.props.loadCommandes({ relaiId: this.props.params.relaiId });
    this.props.loadFournisseurs();
  }

  newCommande = () => {
    this.props.pushState(`/admin/relais/${this.props.params.relaiId}/commandes/nouvelle`);
  }

  editCommande = () => {
    const { relaiId, commandeId } = this.props.params;
    this.props.pushState(`/admin/relais/${relaiId}/commandes/${commandeId}/edit`);
  }

  removeCommande = () => {

  }

  handleChangeList = (event, value) => {
    const { relaiId, action } = this.params;
    this.props.pushState(`/admin/relais/${relaiId}/commandes/${value}${action === 'edit' ? '/edit' : ''}`);
  }

  render() {
    const { commandes, params } = this.props;
    const { action, commandeId } = params;
    if (!commandes) return null;
    const commande = commandes ? commandes[commandeId] : null;
    return (
      <div className="row">
        <div className={classnames('col-md-2', styles.panel)}>
          <div style={{ textAlign: 'center' }}>
            {!commandeId && !action && <IconButton
              style={{ padding: 0, width: '27px', height: '27px' }}
              tooltip="Nouvelle commande"
              onClick={this.newCommande}<commit_msg>correction bug this.params n'existe pas<commit_after>import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { push } from 'react-router-redux';
import { createStructuredSelector } from 'reselect';
import { List, ListItem, makeSelectable } from 'material-ui/List';
import classnames from 'classnames';

import { loadCommandes, loadFournisseurs } from 'containers/Commande/actions';
import { selectCommandesRelais, selectCommandeId } from 'containers/Commande/selectors';
import IconButton from 'material-ui/IconButton';
import AddIcon from 'material-ui/svg-icons/content/add';
import EditIcon from 'material-ui/svg-icons/editor/mode-edit';
import RemoveIcon from 'material-ui/svg-icons/action/delete-forever';

import moment from 'moment';
import styles from './styles.css';

const SelectableList = makeSelectable(List);

class AdminRelaisCommandes extends Component {
  static propTypes = {
    commandes: PropTypes.object.isRequired,
    commandeId: PropTypes.string,
    loadCommandes: PropTypes.func.isRequired,
    loadFournisseurs: PropTypes.func.isRequired,
    pushState: PropTypes.func.isRequired,
    params: PropTypes.object.isRequired,
    children: PropTypes.node,
  }

  componentDidMount() {
    this.props.loadCommandes({ relaiId: this.props.params.relaiId });
    this.props.loadFournisseurs();
  }

  newCommande = () => {
    this.props.pushState(`/admin/relais/${this.props.params.relaiId}/commandes/nouvelle`);
  }

  editCommande = () => {
    const { relaiId, commandeId } = this.props.params;
    this.props.pushState(`/admin/relais/${relaiId}/commandes/${commandeId}/edit`);
  }

  removeCommande = () => {

  }

  handleChangeList = (event, value) => {
    const { relaiId, action } = this.props.params;
    this.props.pushState(`/admin/relais/${relaiId}/commandes/${value}${action === 'edit' ? '/edit' : ''}`);
  }

  render() {
    const { commandes, params } = this.props;
    const { action, commandeId } = params;
    if (!commandes) return null;
    const commande = commandes ? commandes[commandeId] : null;
    return (
      <div className="row">
        <div className={classnames('col-md-2', styles.panel)}>
          <div style={{ textAlign: 'center' }}>
            {!commandeId && !action && <IconButton
              style={{ padding: 0, width: '27px', height: '27px' }}
              tooltip="Nouvelle commande"
              onClick={this.newCommande}
{'fraction_non_alphanumeric': 0.14270962412226354, 'fraction_numerical': 0.0024783147459727386, 'mean_word_length': 3.906788247213779, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4659433', 'n_tokens_mistral': 1507, 'n_tokens_neox': 1515, 'n_words': 303}