Use order notes for comments

This commit is contained in:
Almira Krdzic
2018-08-26 17:23:33 +02:00
committed by GotPPay
parent bd1d8f2103
commit 54e6495795
6 changed files with 88 additions and 33 deletions

View File

@@ -18,19 +18,19 @@ class OrderComments extends Component {
}
addNewComment(){
this.props.dispatch(addComment(this.props.orderInfo.id, this.state.newComment, this.props.orderComments));
this.props.dispatch(addComment(this.props.orderInfo.id, this.state.newComment));
}
onEditorChange(newComment){
this.setState({newComment});
}
getOffset(username){
return (username === localStorage.getItem('username')) ? 6 : 0;
getOffset(isOwner){
return isOwner ? 6 : 0;
}
getClassByOwner(username){
return (username === localStorage.getItem('username')) ? 'mine' : '';
getClassByOwner(isOwner){
return isOwner ? 'mine' : '';
}
render() {
@@ -46,9 +46,9 @@ class OrderComments extends Component {
orderComments &&
orderComments.map((orderComment, index) =>
<Row key={'order-comment-' + index}>
<Col xl={{size:6, offset:this.getOffset(orderComment.username)}}>
<div className={'order-comment ' + this.getClassByOwner(orderComment.username)} key={'order-comment-' + index}>
<div className="order-comment-header">{orderComment.username} - {orderComment.date}</div>
<Col xl={{size:6, offset:this.getOffset(orderComment.isOwner)}}>
<div className={'order-comment ' + this.getClassByOwner(orderComment.isOwner)} key={'order-comment-' + index}>
<div className="order-comment-header">{orderComment.username} - {orderComment.dateCreated}</div>
<div dangerouslySetInnerHTML={{__html: orderComment.comment}}></div>
</div>
</Col>

View File

@@ -26,6 +26,7 @@ $link-line-height: 1.5rem;
.completed {
border-left: $border-width $production-status-color solid;
background: $production-status-color;
}
.end-of-life {
@@ -131,7 +132,7 @@ $link-line-height: 1.5rem;
background: $canceled-status-color;
}
.production {
.completed {
background: $production-status-color;
}