import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { Link } from 'react-router-dom'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { Badge, Card, CardBody, CardFooter, CardHeader, Col, DropdownItem, DropdownMenu, DropdownToggle, Media, Row, UncontrolledDropdown } from 'reactstrap'; import Loader from '../common/Loader'; import ButtonIcon from '../common/ButtonIcon'; import FalconCardHeader from '../common/FalconCardHeader'; import FalconCardFooterLink from '../common/FalconCardFooterLink'; import useFakeFetch from '../../hooks/useFakeFetch'; import { isIterableArray } from '../../helpers/utils'; import createMarkup from '../../helpers/createMarkup'; import rawCustomer from '../../data/customer/customer'; import rawCustomerLogs from '../../data/customer/customerLogs'; const CustomerSummary = () => { const { loading, data: customer } = useFakeFetch(rawCustomer); const { name, email, createdAt } = customer; return ( {loading ? ( ) : (
{name} ({email})
Add note Edit Report Archive Delete user
Customer

Customer was created

{createdAt}

)}
); }; const CustomerDetailRow = ({ title, isLastItem, children }) => (

{title}

{children}
); CustomerDetailRow.propTypes = { title: PropTypes.string.isRequired, children: PropTypes.node.isRequired, isLastItem: PropTypes.bool }; CustomerDetailRow.defaultProps = { last: false }; const CustomerDetail = () => { const { loading, data: customer } = useFakeFetch(rawCustomer); const { id, email, createdAt, description, vat_no, email_to, address, cell, invoice_prefix } = customer; return ( Update details {loading ? ( ) : (
Account Information
{id} {createdAt} {email} {description ? description :

No Description

}
{vat_no ? vat_no :

No VAT Number

}
Billing Information
{email_to}

{cell}

{invoice_prefix}

)}
Refund Save changes
); }; const CustomerLog = ({ status, link, time }) => { let badgeColor = 'soft-warning'; if (status === 404) badgeColor = 'soft-danger'; else if (status === 200) badgeColor = 'soft-success'; return ( {status} POST {link}

{time}

); }; CustomerLog.propTypes = { status: PropTypes.number.isRequired, link: PropTypes.string.isRequired, time: PropTypes.string.isRequired }; const CustomerLogs = () => { const { loading, data: customerLogs } = useFakeFetch(rawCustomerLogs); return ( {loading ? ( ) : ( isIterableArray(customerLogs) && customerLogs.map((log, index) => ) )} ); }; const CustomerDetails = () => ( ); export default CustomerDetails;