We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 1 |
Paths | 1 |
Total Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /* |
||
10 | define(['backgrid', 'lodash', 'accounting'], function(Backgrid, _, Accounting) { |
||
11 | let DiscountFormatter = Backgrid.DiscountFormatter = function() { |
||
|
|||
12 | }; |
||
13 | DiscountFormatter.prototype = new Backgrid.CellFormatter(); |
||
14 | _.extend(DiscountFormatter.prototype, { |
||
15 | fromRaw: function(rawData, model) { |
||
16 | if (!_.isUndefined(model.get('discount.type'))) { |
||
17 | let discountType = model.get('discount.type'); |
||
18 | |||
19 | if ('money' === discountType.toLowerCase()) { |
||
20 | let discountAmount = parseInt(model.get('discount.valueMoney.value'), 10); |
||
21 | |||
22 | if (discountAmount > 0) { |
||
23 | return Accounting.formatMoney(discountAmount / 100, model.get('client').currency); |
||
24 | } |
||
25 | |||
26 | return ''; |
||
27 | } |
||
28 | |||
29 | let discountPercentage = model.get('discount.valuePercentage'); |
||
30 | |||
31 | if (parseInt(discountPercentage, 10) > 0) { |
||
32 | return discountPercentage + '%'; |
||
33 | } |
||
34 | } |
||
35 | }, |
||
36 | toRaw: function(formattedData, model) { |
||
37 | return formattedData; |
||
38 | } |
||
39 | }); |
||
40 | }); |
||
41 |