rerobe-js-orm 2.4.93 → 2.4.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,6 +91,12 @@ class OrderFormState extends FormState_1.default {
91
91
  const hidden = false;
92
92
  if (fieldType === 'textInput') {
93
93
  let inputValue = this.props[fieldKey] || '';
94
+ if (fieldKey === 'firstName') {
95
+ inputValue = this.props.name ? this.props.name.split(' ')[0] : '';
96
+ }
97
+ if (fieldKey === 'lastName') {
98
+ inputValue = this.props.name && this.props.name.split(' ').length > 1 ? this.props.name.split(' ')[1] : '';
99
+ }
94
100
  if (fieldKey === 'subtotalPrice' ||
95
101
  fieldKey === 'totalPrice' ||
96
102
  fieldKey === 'totalDiscount' ||
@@ -508,6 +508,20 @@ class ProductFormState extends FormState_1.default {
508
508
  if (fieldKey === 'materialComposition') {
509
509
  selectedValue = this.props[fieldKey] || {};
510
510
  valid = Object.keys(this.props[fieldKey]).length > 0;
511
+ // Mutate materialComposition options with passed in material obj
512
+ if (this.props.materialComposition && Object.keys(this.props.materialComposition).length > 0) {
513
+ if (!options.map((o) => o.key).every((v) => Object.keys(this.props.materialComposition).includes(v))) {
514
+ Object.keys(this.props.materialComposition).forEach((o) => {
515
+ if (!options.map((opt) => opt.key).includes(this.utilities.camelCase(o))) {
516
+ options.splice(0, 0, {
517
+ label: this.utilities.startCase(o),
518
+ value: this.utilities.startCase(o),
519
+ key: this.utilities.camelCase(o),
520
+ });
521
+ }
522
+ });
523
+ }
524
+ }
511
525
  }
512
526
  if (fieldKey === 'editorAuthorizations') {
513
527
  selectedValue = this.props[fieldKey] || {};
@@ -309,7 +309,10 @@ class ProductStateManager extends Base_1.default {
309
309
  if (status.includes(ProductStateManager.PRODUCT_STATES.clearance)) {
310
310
  return this.state.toClearance();
311
311
  }
312
- return this.state.toListed();
312
+ if (status.includes(ProductStateManager.PRODUCT_STATES.listed)) {
313
+ return this.state.toListed();
314
+ }
315
+ return this.state.toSold();
313
316
  }
314
317
  toLoading() {
315
318
  this.state.toLoading();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rerobe-js-orm",
3
- "version": "2.4.93",
3
+ "version": "2.4.96",
4
4
  "description": "ReRobe's Javascript ORM Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",