{"size": 876, "ext": "js", "max_stars_repo_path": "resources/assets/js/components/presenters/CaseTemplatePresenter.js", "max_stars_repo_name": "turbo124/taskmanager", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "resources/assets/js/components/presenters/CaseTemplatePresenter.js", "max_issues_repo_name": "turbo124/taskmanager", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "resources/assets/js/components/presenters/CaseTemplatePresenter.js", "max_forks_repo_name": "turbo124/taskmanager", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 39.8181818182, "max_line_length": 108, "alphanum_fraction": 0.6461187215}
import React from 'react'
import { Badge } from 'reactstrap'
import { caseStatusColors, caseStatuses } from '../utils/_consts'
import { translations } from '../utils/_translations'

export default function CaseTemplatePresenter (props) {
    const { field, entity } = props

    const status = !entity.deleted_at
        ? <Badge color={caseStatusColors[entity.send_on]}>{caseStatuses[entity.send_on]}</Badge>
        : <Badge className="mr-2" color="warning">{translations.archived}</Badge>

    switch (field) {
        case 'send_on':
            return <td onClick={() => props.toggleViewedEntity(entity, entity.name, props.edit)}
                data-label="Send On">{status}</td>
        default:
            return <td onClick={() => props.toggleViewedEntity(entity, entity.name, props.edit)} key={field}
                data-label={field}>{entity[field]}</td>
    }
}
