2017-07-27 20:18:18 +05:30
|
|
|
import React from "react";
|
|
|
|
import Link from "component/link";
|
2017-08-25 23:33:33 +05:30
|
|
|
import { FormRow } from "component/form";
|
2017-07-27 20:18:18 +05:30
|
|
|
|
|
|
|
class TipLink extends React.PureComponent {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
2017-08-26 00:11:31 +05:30
|
|
|
tipAmount: 1.0,
|
2017-07-27 20:18:18 +05:30
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-08-08 03:43:58 +05:30
|
|
|
handleSendButtonClicked() {
|
|
|
|
let claim_id = this.props.claim_id;
|
2017-08-25 23:33:33 +05:30
|
|
|
let amount = this.state.tipAmount;
|
2017-08-14 15:13:40 +05:30
|
|
|
this.props.sendSupport(amount, claim_id);
|
2017-07-28 05:04:42 +05:30
|
|
|
this.props.onTipHide();
|
2017-07-27 20:18:18 +05:30
|
|
|
}
|
|
|
|
|
2017-08-08 03:43:58 +05:30
|
|
|
handleSupportCancelButtonClicked() {
|
2017-07-28 05:04:42 +05:30
|
|
|
this.props.onTipHide();
|
2017-07-27 20:18:18 +05:30
|
|
|
}
|
|
|
|
|
2017-08-25 23:33:33 +05:30
|
|
|
handleSupportPriceChange(event) {
|
2017-07-27 20:18:18 +05:30
|
|
|
this.setState({
|
2017-08-26 00:11:31 +05:30
|
|
|
tipAmount: Number(event.target.value),
|
2017-07-29 12:20:17 +05:30
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-07-27 20:18:18 +05:30
|
|
|
render() {
|
|
|
|
return (
|
2017-08-25 23:33:33 +05:30
|
|
|
<div className="card__content">
|
|
|
|
<div className="card__title-primary">
|
|
|
|
<h4>{__("Support Claim")}</h4>
|
|
|
|
</div>
|
|
|
|
<div className="card__content">
|
|
|
|
<FormRow
|
|
|
|
label={__("Amount")}
|
|
|
|
postfix={__("LBC")}
|
|
|
|
min="0"
|
|
|
|
step="0.1"
|
|
|
|
type="number"
|
|
|
|
placeholder="1.00"
|
|
|
|
onChange={event => this.handleSupportPriceChange(event)}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div className="card__actions">
|
|
|
|
<Link
|
|
|
|
label={__("Send")}
|
|
|
|
button="primary"
|
|
|
|
onClick={this.handleSendButtonClicked.bind(this)}
|
|
|
|
/>
|
|
|
|
<Link
|
|
|
|
label={__("Cancel")}
|
|
|
|
button="alt"
|
|
|
|
onClick={this.handleSupportCancelButtonClicked.bind(this)}
|
|
|
|
/>
|
|
|
|
</div>
|
2017-07-27 22:25:51 +05:30
|
|
|
</div>
|
2017-07-27 20:18:18 +05:30
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TipLink;
|