|
2 | 2 | // IMPORTANT:
|
3 | 3 | // You must update ResourceUrl.RESOURCES_VERSION each time whenever you're modified this file!
|
4 | 4 | //
|
5 |
| -// @todo #1342 AddCatalogPriceForm: show a currency |
6 | 5 |
|
7 | 6 | class AddCatalogPriceForm extends React.Component {
|
8 | 7 | constructor(props) {
|
@@ -33,6 +32,21 @@ class AddCatalogPriceForm extends React.Component {
|
33 | 32 | });
|
34 | 33 | }
|
35 | 34 |
|
| 35 | + getCurrencyByCatalogName(catalog) { |
| 36 | + switch (catalog) { |
| 37 | + case 'michel': |
| 38 | + case 'yvert': |
| 39 | + return ['\u20AC', 'EUR']; |
| 40 | + case 'scott': |
| 41 | + return ['$', 'USD']; |
| 42 | + case 'gibbons': |
| 43 | + return ['\u00A3', 'GBP']; |
| 44 | + case 'solovyov': |
| 45 | + case 'zagorski': |
| 46 | + return ['\u20BD', 'RUB']; |
| 47 | + } |
| 48 | + } |
| 49 | + |
36 | 50 | handleSubmit(event) {
|
37 | 51 | event.preventDefault();
|
38 | 52 |
|
@@ -86,6 +100,8 @@ class AddCatalogPriceForm extends React.Component {
|
86 | 100 | }
|
87 | 101 | render() {
|
88 | 102 | const hasValidationErrors = this.state.validationErrors.length > 0;
|
| 103 | + const [currencySymbol, currencyName] = this.getCurrencyByCatalogName(this.state.catalog); |
| 104 | + |
89 | 105 | return (
|
90 | 106 | <div className="col-sm-12 form-group">
|
91 | 107 | <form className={`form-horizontal ${hasValidationErrors ? 'has-error' : ''}`} onSubmit={this.handleSubmit}>
|
@@ -128,18 +144,19 @@ class AddCatalogPriceForm extends React.Component {
|
128 | 144 | <div className="form-group form-group-sm">
|
129 | 145 | <label className="control-label col-sm-3">
|
130 | 146 | { this.props.l10n['t_price'] || 'Price' }
|
131 |
| - </label> |
132 |
| - <div className="col-sm-6"> |
133 |
| - <div className="row"> |
134 |
| - <div className="col-xs-6"> |
135 |
| - <input |
136 |
| - className="form-control" |
137 |
| - id="catalog-price" |
138 |
| - type="text" |
139 |
| - size="5" |
140 |
| - required="required" |
141 |
| - onChange={ this.handleChangePrice }/> |
142 |
| - </div> |
| 147 | + </label> |
| 148 | + <div className="row"> |
| 149 | + <div className="col-sm-6"> |
| 150 | + <div className="col-xs-6 input-group"> |
| 151 | + <span className="input-group-addon">{ currencySymbol }</span> |
| 152 | + <input |
| 153 | + type="text" |
| 154 | + className="form-control js-with-tooltip" |
| 155 | + size="5" |
| 156 | + title={ currencyName } |
| 157 | + required="required" |
| 158 | + onChange={ this.handleChangePrice }/> |
| 159 | + </div> |
143 | 160 | </div>
|
144 | 161 | </div>
|
145 | 162 | </div>
|
|
0 commit comments