import React, {Component} from 'react'; import {Col} from 'reactstrap'; import WiaasBox from '../../../mainComponents/box/WiaasBox.jsx'; import {WiaasTable, WiaasTableHeader, WiaasTableBody, WiaasTableRow, WiaasTableCol} from '../../../mainComponents/table/WiaasTable.jsx'; import {orderTexts} from '../../../constants/ordersConstants'; import '../style/Orders.css'; class OrderPackage extends Component { calculateRecuringPrice(packageDetails) { return packageDetails.units * (parseFloat(packageDetails.packageRecuringPrice) + parseFloat(packageDetails.packageServicePrice)); } calculateQuantityPrice(quantity, price, recurringPrice = 0) { return quantity * parseFloat(price + recurringPrice); } getHeadersByType(type) { if(type === 'active') { return ['Package', 'Price', 'Services and support', 'Delivery active step']; } return ['Package', 'Price', 'Services and support', 'End of Life']; } render() { const {order, type} = this.props; return (
{orderTexts.labels.DELIVERY_ADDRESS}: {order.deliveryAddress} {orderTexts.labels.PHONE_NUMBER}: {order.phone} {orderTexts.labels.MAIL}: {order.mail} {order.clName} {orderTexts.labels.PHONE_NUMBER}: {order.commercialLeadPhone} {order.clName} {orderTexts.labels.MAIL}: {order.commercialLeadMail}
{order.packages.map((orderPackage, index) =>
{orderPackage.units} x {orderPackage.packageName}
{this.calculateQuantityPrice(orderPackage.units, orderPackage.packageFixedPrice).toLocaleString()} {orderPackage.packageCurrency && orderPackage.packageCurrency.currency} {' '} ({orderPackage.paymentType}) {this.calculateQuantityPrice(orderPackage.units, orderPackage.packageServicePrice, orderPackage.packageRecuringPrice).toLocaleString() + ' / ' + orderPackage.periodUnit + ' '} {orderTexts.labels.EXTEND} {orderPackage.periodUnit} (Max {orderPackage.maxContractPeriod}) { type === 'active' ? orderPackage.shortDesc ? orderPackage.shortDesc : '-' : orderPackage.endOfLife ? orderPackage.endOfLife : '-' }
)}
); } } export default OrderPackage;