Compare commits

..

No commits in common. "06ca8f24cfbb454a9a9ad82b074ca616d642872a" and "21ed7d3c17ec9f02b41c234ed9325791efa6f9fe" have entirely different histories.

3 changed files with 23 additions and 69 deletions

View File

@ -160,7 +160,7 @@ button {
font-size: .8rem;
table {
max-width: 450px;
max-width: 350px;
}
.summary-remove-all {
@ -176,7 +176,7 @@ button {
}
.price {
text-align: right;
text-align: left;
}
.item-card-name > div,

View File

@ -108,24 +108,6 @@ const nbrOccupiedSlotsInCrate = (items) => {
}, 0);
};
function formatMoney(amount, decimalCount = 2, decimal = ".", thousands = ",") {
// https://stackoverflow.com/questions/149055/how-can-i-format-numbers-as-currency-string-in-javascript
// changes: return amount if error in order to avoid empty value
try {
decimalCount = Math.abs(decimalCount);
decimalCount = isNaN(decimalCount) ? 2 : decimalCount;
const negativeSign = amount < 0 ? "-" : "";
let i = parseInt(amount = Math.abs(Number(amount) || 0).toFixed(decimalCount)).toString();
let j = (i.length > 3) ? i.length % 3 : 0;
return negativeSign + (j ? i.substr(0, j) + thousands : '') + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands) + (decimalCount ? decimal + Math.abs(amount - i).toFixed(decimalCount).slice(2) : "");
} catch (e) {
return amount;
}
};
/**
* Component that provides a base layout (aside/main) for the page.
@ -214,7 +196,7 @@ class ProductItem extends React.PureComponent {
<div className="content">
<h3>{name}</h3>
<div className="price">{`${currency} ${formatMoney(price)}`}</div>
<div className="price">{`${currency} ${price}`}</div>
{render_specs}
</div>
@ -456,7 +438,7 @@ class ProductCartItem extends React.PureComponent {
<img src="/images/shop/icon-remove.svg" alt="rm"/>
<p>Remove</p>
<p>remove</p>
</div>
{/* progression container */}
@ -909,18 +891,11 @@ class OrderSumary extends React.PureComponent {
<tr>
<td className="item-card-name">{mode.name}</td>
<td className="price">
<div>
{`${currency} ${formatMoney(mode.price)}`}
{`${currency} ${mode.price}`}
<button style={{'opacity': '0', 'cursor': 'initial'}}>
<img src="/images/shop/icon-remove.svg" />
</button>
</div>
<span style={{
'display': 'inline-block',
'width': '30px',
}}>&nbsp;</span>
</td>
</tr>
)}
@ -952,7 +927,7 @@ class OrderSumary extends React.PureComponent {
<td className="price">
<div>
{`${currency} ${formatMoney(item.price)}`}
{`${currency} ${item.price}`}
<button onClick={this.handleOnDeleteItem.bind(this, index)}>
<img src="/images/shop/icon-remove.svg" />
@ -966,13 +941,6 @@ class OrderSumary extends React.PureComponent {
src={`/images/${warning.icon}`}
/>
)}
{!warning && (
<span style={{
'display': 'inline-block',
'width': '30px',
}}>&nbsp;</span>
)}
</td>
</tr>
);
@ -983,26 +951,19 @@ class OrderSumary extends React.PureComponent {
<tr>
<td className="item-card-name">Price estimate</td>
<td className="price">
<div>
{summary.length ? (
`${currency} ${formatMoney(summary.reduce(
`${currency} ${summary.reduce(
(prev, next) => {
return prev + next.price;
}, 0
) + mode.price)}`
) + mode.price}`
) : (
`${currency} ${formatMoney(mode.price)}`
`${currency} ${mode.price}`
)}
<button style={{'opacity': '0', 'cursor': 'initial'}}>
<img src="/images/shop/icon-remove.svg" alt="icon remove"/>
</button>
</div>
<span style={{
'display': 'inline-block',
'width': '30px',
}}>&nbsp;</span>
</td>
</tr>
</tfoot>

11
static/js/shop.min.js vendored

File diff suppressed because one or more lines are too long