-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Customer Component. Used at OrderShow. #23
- Loading branch information
Showing
5 changed files
with
69 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
export default function debounce(func, wait) { | ||
let timeout = null; | ||
return function() { | ||
const ctx = this; | ||
const args = arguments; | ||
const later = function() { | ||
timeout = null; | ||
func.apply(ctx, args); | ||
export default class Utils { | ||
static debounce(func, wait) { | ||
let timeout = null; | ||
return function() { | ||
const ctx = this; | ||
const args = arguments; | ||
const later = function() { | ||
timeout = null; | ||
func.apply(ctx, args); | ||
} | ||
clearTimeout(timeout); | ||
timeout = setTimeout(later, wait || 200); | ||
} | ||
clearTimeout(timeout); | ||
timeout = setTimeout(later, wait || 200); | ||
} | ||
static dateToHumanReadableString(iso8601) { | ||
return new Date(iso8601).toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export default class Customer extends Component { | ||
render(){ | ||
const customer = this.props.customer; | ||
return ( | ||
<div className="pull-right"> | ||
<dl className="dl-horizontal"> | ||
<dt>Reference</dt> | ||
<dd>{customer.reference}</dd> | ||
<dt>Company Name</dt> | ||
<dd>{customer.company_name}</dd> | ||
<dt>Address</dt> | ||
<dd>{customer.address}</dd> | ||
<dt>Telephone</dt> | ||
<dd>{customer.telephone}</dd> | ||
<dt>Email</dt> | ||
<dd>{customer.email}</dd> | ||
<dt>Contact Name</dt> | ||
<dd>{customer.contact_name}</dd> | ||
<dt>Contact Surname</dt> | ||
<dd>{customer.contact_surname}</dd> | ||
</dl> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
Customer.propTypes = { | ||
customer: PropTypes.object.isRequired, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters