@appcorp/stellar-solutions-invoice-module 0.1.7 → 0.1.8

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.
@@ -548,9 +548,28 @@ var useInvoiceState = function () {
548
548
  return elements;
549
549
  }, [state, handleChange, companies]);
550
550
  var dynamicPricingFormElements = (0, react_1.useMemo)(function () {
551
+ var _a, _b, _c, _d;
551
552
  var elements = __assign({}, constants_1.staticPricingSection);
553
+ var textElements = (_a = elements[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_INPUT_V1]) === null || _a === void 0 ? void 0 : _a.sort(function (a, b) { return a.order - b.order; });
554
+ if (textElements) {
555
+ textElements[0].value = state.subTotal;
556
+ textElements[0].error = (_b = state.errors) === null || _b === void 0 ? void 0 : _b.subTotal;
557
+ textElements[0].handleOnChange = handleChange;
558
+ textElements[1].value = state.discount;
559
+ textElements[1].error = (_c = state.errors) === null || _c === void 0 ? void 0 : _c.discount;
560
+ textElements[1].handleOnChange = handleChange;
561
+ textElements[2].value = state.totalDiscount ? String(state.totalDiscount) : '0';
562
+ textElements[2].label = 'Total Discounted Price';
563
+ textElements[3].value = isNaN(Number(state.totalTax)) ? '0' : state.totalTax;
564
+ textElements[3].label = 'After Tax';
565
+ textElements[4].value = isNaN(Number(state.total))
566
+ ? '0'
567
+ : String(state.total);
568
+ textElements[4].error = (_d = state.errors) === null || _d === void 0 ? void 0 : _d.total;
569
+ textElements[4].handleOnChange = handleChange;
570
+ }
552
571
  return elements;
553
- }, []);
572
+ }, [handleChange, state]);
554
573
  var dynamicServiceFormElements = (0, react_1.useMemo)(function () {
555
574
  var _a, _b;
556
575
  var elements = __assign({}, constants_1.staticServiceSection);
@@ -68,6 +68,8 @@ exports.initialInvoiceState = {
68
68
  subTotal: '',
69
69
  taxValue: '',
70
70
  total: '',
71
+ totalDiscount: '',
72
+ totalTax: '',
71
73
  services: [
72
74
  {
73
75
  mode: 'Create',
@@ -129,6 +129,8 @@ export interface InvoiceState extends Omit<InvoiceTypeBE, 'createdAt' | 'updated
129
129
  email: string;
130
130
  city: string;
131
131
  address: string;
132
+ totalTax: string;
133
+ totalDiscount: string;
132
134
  }
133
135
  export interface FetchInvoicesArgs {
134
136
  currentPage: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/stellar-solutions-invoice-module",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "scripts": {
5
5
  "build": "yarn clean && yarn build:ts && cp package.json lib && cp README.md lib",
6
6
  "build:next": "next build",