@appcorp/stellar-solutions-invoice-module 0.1.30 → 0.1.31

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.
@@ -228,7 +228,7 @@ exports.staticCustomerSection = (_b = {},
228
228
  exports.staticPricingSection = (_c = {},
229
229
  _c[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_INPUT_V1] = [
230
230
  {
231
- disabled: true,
231
+ disabled: false,
232
232
  enabled: true,
233
233
  error: '',
234
234
  handleOnChange: function () { return void 0; },
@@ -236,6 +236,7 @@ exports.staticPricingSection = (_c = {},
236
236
  label: 'Sub Total',
237
237
  order: 1,
238
238
  placeholder: '0.00',
239
+ readOnly: true,
239
240
  required: false,
240
241
  type: 'text',
241
242
  value: '',
@@ -148,6 +148,7 @@ var useInvoiceState = function () {
148
148
  expiryDate: state.expiryDate,
149
149
  id: state.id,
150
150
  invoiceStatus: state.invoiceStatus,
151
+ mode: state.mode,
151
152
  note: state.note,
152
153
  products: state.products,
153
154
  quoteStatus: state.quoteStatus,
@@ -156,7 +157,6 @@ var useInvoiceState = function () {
156
157
  subTotal: state.subTotal,
157
158
  taxRate: state.taxRate,
158
159
  total: state.total,
159
- mode: state.mode,
160
160
  }); }, [state]);
161
161
  var updateCallback = function (_a) {
162
162
  var data = _a.data, error = _a.error;
@@ -185,6 +185,7 @@ var useInvoiceState = function () {
185
185
  id: state.id,
186
186
  };
187
187
  var byIdCallback = function (_a) {
188
+ var _b, _c;
188
189
  var data = _a.data, error = _a.error;
189
190
  if (error) {
190
191
  (0, generate_toast_1.generateToast)({
@@ -193,8 +194,23 @@ var useInvoiceState = function () {
193
194
  });
194
195
  }
195
196
  if (data) {
196
- var updatedServices = __spreadArray([], data.services, true).map(function (item) { return (__assign(__assign({}, item), { rowTotal: Number(item.quantity) * Number(item.price) })); });
197
- var updatedData = __assign(__assign({}, data), { services: __spreadArray([], updatedServices, true) });
197
+ var updatedServices = __spreadArray([], data.services, true).map(function (item) {
198
+ delete item.quoteInvoiceId;
199
+ return (__assign(__assign({}, item), { rowTotal: Number(item.quantity) * Number(item.price) }));
200
+ });
201
+ var updatedData = __assign(__assign({}, data), { mode: 'Edit', companyId: data.company.id, services: __spreadArray([], updatedServices, true) });
202
+ if ((_b = updatedData === null || updatedData === void 0 ? void 0 : updatedData.company) === null || _b === void 0 ? void 0 : _b.name) {
203
+ dispatch({
204
+ type: actions_1.INVOICE_ACTION_TYPES.SET_FORM_TO_RENDER,
205
+ payload: { formToRender: 'company' },
206
+ });
207
+ }
208
+ if ((_c = updatedData === null || updatedData === void 0 ? void 0 : updatedData.customer) === null || _c === void 0 ? void 0 : _c.name) {
209
+ dispatch({
210
+ type: actions_1.INVOICE_ACTION_TYPES.SET_FORM_TO_RENDER,
211
+ payload: { formToRender: 'customer' },
212
+ });
213
+ }
198
214
  dispatch({
199
215
  type: actions_1.INVOICE_ACTION_TYPES.SET_FORM,
200
216
  payload: { form: updatedData },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/stellar-solutions-invoice-module",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
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",