<commit_before>/**
 * ValidateValuesOverlay.jsx
 * Created by <NAME> 3/31/2016
 */

import React from 'react';
import { hashHistory } from 'react-router';
import * as Icons from '../../SharedComponents/icons/Icons.jsx';

const defaultProps = {
	allowUpload: false
};

export default class ValidateValuesOverlay extends React.Component {

	constructor(props) {
		super(props);
	}

	pressedNext(e) {

		hashHistory.push('/reviewData/' + this.props.submission.id);

	}

	isUploadingFiles() {
		if (Object.keys(this.props.submission.files).length > 0) {
			return true;
		}
		return false;
	}

	render() {

		let uploadButtonClass = '-disabled';
		let uploadButtonDisabled = true;

		let nextButtonClass = ' hide';
		let nextButtonDisabled = true;
		if (this.props.allowUpload) {
			uploadButtonDisabled = false;
			uploadButtonClass = ' btn-primary';
		}


		let message = 'You must fix the Critical Errors found in ' + this.props.errors.length + ' of the .CSV files before moving on to the next step. View and download individual reports above.';

		if (this.props.errors.length == 0) {

			message = 'No Critical Errors were found in the .CSV files. Click Next to review and publish these files.';
			uploadButtonDisabled = true;
			uploadButtonClass = '-disabled';
			nextButtonClass = ' btn-primary';
			nextButtonDisabled = false;

			if (this.isUploadingFiles()) {
				uploadButtonDisabled = false;
				uploadButtonClass = ' btn-primary';
			}


		}

		let buttonText = 'Upload Corrected CSV Files';
		if (this.props.submission.state == 'uploading') {
			uploadButtonDisabled = true;
			uploadButtonClass = '-disabled';
			buttonText = 'Uploading files...';
		}
		else if (this.props.submission.state == 'prepare') {
			uploadButtonDisabled = true;
			uploadButtonDisabled = '-disabled';
			buttonText = 'Gathering data...';
		}


		return (
			<div className="center-block usa-da-validation-overlay" data-testid="validate-value-overlay">
				<div className="container">
					<div className="row">
						<div className="col-md-8 usa-da-overlay-content-wrap">
							<div className="row">
								<div className="col-xs-2 col-md-1 usa-da-icon">
									<Icons.CheckCircle />
								</div>
								<div className="col-xs-10 col-md-11">
									<h6>{message}</h6>
								</div>
							</div>
						</div>
						<div className="col-md-4">
							<div className='usa-da-btn-bg'><commit_msg>Show exclamation point icon in overlay until all files pass validation<commit_after>/**
 * ValidateValuesOverlay.jsx
 * Created by <NAME> 3/31/2016
 */

import React from 'react';
import { hashHistory } from 'react-router';
import * as Icons from '../../SharedComponents/icons/Icons.jsx';

const defaultProps = {
	allowUpload: false
};

export default class ValidateValuesOverlay extends React.Component {

	constructor(props) {
		super(props);
	}

	pressedNext(e) {

		hashHistory.push('/reviewData/' + this.props.submission.id);

	}

	isUploadingFiles() {
		if (Object.keys(this.props.submission.files).length > 0) {
			return true;
		}
		return false;
	}

	render() {

		let icon = <Icons.ExclamationCircle />;

		let uploadButtonClass = '-disabled';
		let uploadButtonDisabled = true;

		let nextButtonClass = ' hide';
		let nextButtonDisabled = true;
		if (this.props.allowUpload) {
			uploadButtonDisabled = false;
			uploadButtonClass = ' btn-primary';
		}


		let message = 'You must fix the Critical Errors found in ' + this.props.errors.length + ' of the .CSV files before moving on to the next step. View and download individual reports above.';

		if (this.props.errors.length == 0) {
			icon = <Icons.CheckCircle />;
			message = 'No Critical Errors were found in the .CSV files. Click Next to review and publish these files.';
			uploadButtonDisabled = true;
			uploadButtonClass = '-disabled';
			nextButtonClass = ' btn-primary';
			nextButtonDisabled = false;

			if (this.isUploadingFiles()) {
				uploadButtonDisabled = false;
				uploadButtonClass = ' btn-primary';
			}


		}

		let buttonText = 'Upload Corrected CSV Files';
		if (this.props.submission.state == 'uploading') {
			uploadButtonDisabled = true;
			uploadButtonClass = '-disabled';
			buttonText = 'Uploading files...';
		}
		else if (this.props.submission.state == 'prepare') {
			uploadButtonDisabled = true;
			uploadButtonDisabled = '-disabled';
			buttonText = 'Gathering data...';
		}


		return (
			<div className="center-block usa-da-validation-overlay" data-testid="validate-value-overlay">
				<div className="container">
					<div className="row">
						<div className="col-md-8 usa-da-overlay-content-wrap">
							<div className="row">
								<div className="col-xs-2 col-md-1 usa-da-icon">
									{icon}
								</div>
								<div className="col-xs-10 col-md-11">
									<h6>{message}</h6>
								</div>
							</div>
						</div>
						<div className="col-md-4">
							<div className='usa-da-btn-bg'>
{'fraction_non_alphanumeric': 0.13507447459702102, 'fraction_numerical': 0.007753519689859213, 'mean_word_length': 3.1969178082191783, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1117487', 'n_tokens_mistral': 1851, 'n_tokens_neox': 1508, 'n_words': 378}