{"size": 1403, "ext": "js", "max_stars_repo_path": "app/containers/Phases/Document/CarpetaDigital/Credit/index.js", "max_stars_repo_name": "artur-master/ssilva-front-end", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/containers/Phases/Document/CarpetaDigital/Credit/index.js", "max_issues_repo_name": "artur-master/ssilva-front-end", "max_issues_repo_issues_event_min_datetime": "2020-06-28T00:18:21.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-03T03:01:40.000Z", "max_forks_repo_path": "app/containers/Phases/Document/CarpetaDigital/Credit/index.js", "max_forks_repo_name": "artur-master/ssilva-front-end", "max_forks_repo_forks_event_min_datetime": "2022-02-02T20:26:50.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-02T20:26:50.000Z"}
{"max_stars_count": null, "max_issues_count": 2, "max_forks_count": 1, "avg_line_length": 26.9807692308, "max_line_length": 79, "alphanum_fraction": 0.5737704918}
/**
 *
 * Project
 *
 */
import React from 'react';

import PropTypes from 'prop-types';
import { List } from 'components/List';
import { getDocuments } from '../../documents';
import DocumentItem from '../../DocumentItem';

export function Credit({ entity, canUpload, canReview, onReview }) {
  const documents = getDocuments(entity);
  // skip the first document 'Transferencia/DocumentPagoGarantia'
  return (
    <List>
      {documents
        .filter((item, index) => (
          index > 0 &&
          (item.documentoType === "DocumentSimulador" || !item.autoGenerate) &&
          !item.offerta))
        .map((document, index) => (
          <DocumentItem
            key={document.documentoType}
            {...document}
            required={
              document.required ||
              (document.documentoType === 'DocumentCertificadoMatrimonio' &&
                entity.Cliente.CivilStatus === 'Casado(a)')
            }
            Documentos={entity.DocumentNew? {} : entity.Documents || {}}
            className={index > 0 ? 'border-top' : ''}
            canUpload={canUpload}
            canReview={canReview}
            onReview={onReview}
            entity={entity}
          />
        ))}
    </List>
  );
}

Credit.propTypes = {
  canUpload: PropTypes.bool,
  canReview: PropTypes.bool,
  entity: PropTypes.object,
  onReview: PropTypes.func,
};

export default Credit;
