henrybuilt-js-library
Advanced tools
Comparing version 1.8.214 to 1.8.215
{ | ||
"name": "henrybuilt-js-library", | ||
"version": "1.8.214", | ||
"version": "1.8.215", | ||
"description": "", | ||
@@ -33,3 +33,2 @@ "main": "index.js", | ||
"dinero.js": "^1.6.0", | ||
"dxf-writer": "^1.12.1", | ||
"idempotent-babel-polyfill": "^7.4.4", | ||
@@ -36,0 +35,0 @@ "inflection": "^1.12.0", |
@@ -10,3 +10,2 @@ if (typeof(window) !== 'undefined') global.fetch = require('whatwg-fetch').fetch; | ||
date: require('./date/date'), | ||
dxf: require('./dxf'), | ||
event: require('./event'), | ||
@@ -13,0 +12,0 @@ formData: require('./formData'), |
@@ -271,3 +271,3 @@ var libMaterials = require('@src/materials/materials'); | ||
var productOption = _.find(productOptions, {id: productOptionInstance.productOptionId}); | ||
var pricingRule = _.find(pricingRules, {id: productOption.pricingRuleId}); | ||
var pricingRule = _.find(pricingRules, {id: productOption[`${project.companyKey}PricingRuleId`]}); | ||
var unitPrice = dinero(0); | ||
@@ -286,5 +286,15 @@ | ||
var width = _.get(productInstance, 'dimensions.width', 0); //return max price if we don't have an instance | ||
if (width > 42 && width <= 72) unitPrice = dinero(1200); | ||
if (width > 72) unitPrice = dinero(1500); | ||
if (width > 72) unitPrice = dinero(1500); | ||
if (moment(project.pricingDate).isSameOrAfter('2022-03-01')) { | ||
unitPrice = unitPrice.multiply(1.08); | ||
} | ||
if (project.companyKey === 'vp') { | ||
unitPrice = unitPrice.multiply(0.7); //vp discount only applies to lighting | ||
} | ||
unitPrice = dinero((Math.ceil(unitPrice.getAmount() / 500) * 500) / 100); //hint round to nearest 5 | ||
} | ||
@@ -291,0 +301,0 @@ |
@@ -112,3 +112,3 @@ describe('lib.price', () => { | ||
var productOptions = [ | ||
{id: 1, price: 100, pricingRuleId: 5, } | ||
{id: 1, price: 100, hbPricingRuleId: 5, vpPricingRuleId: 6} | ||
]; | ||
@@ -134,3 +134,4 @@ | ||
]}, | ||
{id: 5, expressions: [{type: 'fixed', props: {price: 100}}]} | ||
{id: 5, expressions: [{type: 'fixed', props: {price: 100}}]}, | ||
{id: 6, expressions: [{type: 'fixed', props: {price: 50}}]} | ||
]; | ||
@@ -137,0 +138,0 @@ |
Sorry, the diff of this file is too big to display
13
875672
65
8121
- Removeddxf-writer@^1.12.1
- Removeddxf-writer@1.18.4(transitive)