align fee column to the right

This commit is contained in:
Bilal Catic
2019-06-17 13:09:30 +02:00
parent 781943026a
commit d134f7ac4b

View File

@@ -27,6 +27,12 @@ class IncidentsReport extends Component {
const columnTitle = incidentsReportHeaderTitles[header]; const columnTitle = incidentsReportHeaderTitles[header];
if (columnTitle){ if (columnTitle){
const columnAlignments = {
left: 'left',
right: 'right',
};
let columnContentsAlignment = columnAlignments.left;
columns.push({ columns.push({
Header: incidentsReportHeaderTitles[header], Header: incidentsReportHeaderTitles[header],
accessor: header, accessor: header,
@@ -55,14 +61,16 @@ class IncidentsReport extends Component {
case 'totalChargeFee': case 'totalChargeFee':
const totalFee = props.value ? props.value : props.row['_original'].incidentPrice; const totalFee = props.value ? props.value : props.row['_original'].incidentPrice;
cellValue = `$ ${totalFee}`; const totalFeeFormatted = parseFloat(totalFee).toFixed(2);
cellValue = `$ ${totalFeeFormatted}`;
columnContentsAlignment = columnAlignments.right;
break; break;
default: default:
cellValue = props.value; cellValue = props.value;
} }
return <span>{cellValue}</span> return <div style={{ textAlign: columnContentsAlignment }}>{cellValue}</div>
} }
}); });
} }