@appcorp/stellar-solutions-invoice-module 0.1.26 → 0.1.27
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.
- package/base-modules/invoice/actions.d.ts +9 -2
- package/base-modules/invoice/actions.js +1 -0
- package/base-modules/invoice/constants.d.ts +1 -0
- package/base-modules/invoice/constants.js +115 -15
- package/base-modules/invoice/context.js +177 -129
- package/base-modules/invoice/customer-form-elements.d.ts +3 -0
- package/base-modules/invoice/customer-form-elements.js +41 -0
- package/base-modules/invoice/customer-form-section.d.ts +2 -0
- package/base-modules/invoice/customer-form-section.js +17 -0
- package/base-modules/invoice/form.js +5 -49
- package/base-modules/invoice/reducer.js +4 -0
- package/base-modules/invoice/types.d.ts +6 -5
- package/package.json +1 -1
|
@@ -24,7 +24,8 @@ export declare enum INVOICE_ACTION_TYPES {
|
|
|
24
24
|
SET_FORM = "SET_FORM",
|
|
25
25
|
SET_DISABLE_SAVE_BUTTON = "SET_DISABLE_SAVE_BUTTON",
|
|
26
26
|
SET_AFTER_DISCOUNT = "SET_AFTER_DISCOUNT",
|
|
27
|
-
SET_TAX = "SET_TAX"
|
|
27
|
+
SET_TAX = "SET_TAX",
|
|
28
|
+
SET_FORM_TO_RENDER = "SET_FORM_TO_RENDER"
|
|
28
29
|
}
|
|
29
30
|
export type InvoiceUpdateFieldAction = {
|
|
30
31
|
type: INVOICE_ACTION_TYPES.SET_INPUT_FIELD;
|
|
@@ -155,4 +156,10 @@ export type InvoiceSetTaxAction = {
|
|
|
155
156
|
tax: string;
|
|
156
157
|
};
|
|
157
158
|
};
|
|
158
|
-
export type
|
|
159
|
+
export type InvoiceSetFormToRenderAction = {
|
|
160
|
+
type: INVOICE_ACTION_TYPES.SET_FORM_TO_RENDER;
|
|
161
|
+
payload: {
|
|
162
|
+
formToRender: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
export type InvoiceActions = InvoiceAddItemProductAction | InvoiceAddItemServiceAction | InvoiceClearErrorAction | InvoiceDeleteItemProductAction | InvoiceDeleteItemServiceAction | InvoiceResetFormAction | InvoiceSetButtonDisableAction | InvoiceSetCurrentPageAction | InvoiceSetCustomerDataAction | InvoiceSetDiscountUnitAction | InvoiceSetErrorsAction | InvoiceSetFormLoadingAction | InvoiceSetInvoicesAction | InvoiceSetInvoiceFormAction | InvoiceSetIsInvoiceApiSuccessAction | InvoiceSetMaxPageLimitAction | InvoiceSetSearchQueryAction | InvoiceUpdateFieldAction | InvoiceToggleLoadingAction | InvoiceSetDrawerAction | InvoiceSetCountAction | InvoiceSetFormAction | InvoiceSetAfterDiscountAction | InvoiceSetTaxAction | InvoiceSetFormToRenderAction;
|
|
@@ -28,4 +28,5 @@ var INVOICE_ACTION_TYPES;
|
|
|
28
28
|
INVOICE_ACTION_TYPES["SET_DISABLE_SAVE_BUTTON"] = "SET_DISABLE_SAVE_BUTTON";
|
|
29
29
|
INVOICE_ACTION_TYPES["SET_AFTER_DISCOUNT"] = "SET_AFTER_DISCOUNT";
|
|
30
30
|
INVOICE_ACTION_TYPES["SET_TAX"] = "SET_TAX";
|
|
31
|
+
INVOICE_ACTION_TYPES["SET_FORM_TO_RENDER"] = "SET_FORM_TO_RENDER";
|
|
31
32
|
})(INVOICE_ACTION_TYPES || (exports.INVOICE_ACTION_TYPES = INVOICE_ACTION_TYPES = {}));
|
|
@@ -12,6 +12,7 @@ export declare const toastErrors: {
|
|
|
12
12
|
formSubmittedSuccess: string;
|
|
13
13
|
};
|
|
14
14
|
export declare const staticCompanySection: VistaFormElements;
|
|
15
|
+
export declare const staticCustomerSection: VistaFormElements;
|
|
15
16
|
export declare const staticPricingSection: VistaFormElements;
|
|
16
17
|
export declare const staticServiceSection: VistaFormElements;
|
|
17
18
|
export declare const staticProductSection: VistaFormElements;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
var _a, _b, _c, _d;
|
|
5
|
+
var _a, _b, _c, _d, _e;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.messages = exports.tableBodyCols = exports.INVOICE_API_ROUTES = exports.staticProductSection = exports.staticServiceSection = exports.staticPricingSection = exports.staticCompanySection = exports.toastErrors = exports.changeActionsMap = exports.handleSplitId = exports.pageLimit = void 0;
|
|
7
|
+
exports.messages = exports.tableBodyCols = exports.INVOICE_API_ROUTES = exports.staticProductSection = exports.staticServiceSection = exports.staticPricingSection = exports.staticCustomerSection = exports.staticCompanySection = exports.toastErrors = exports.changeActionsMap = exports.handleSplitId = exports.pageLimit = void 0;
|
|
8
8
|
var react_1 = __importDefault(require("react"));
|
|
9
9
|
var util_functions_1 = require("@react-pakistan/util-functions");
|
|
10
10
|
var form_schema_1 = require("@appcorp/app-corp-vista/utils/form-schema");
|
|
@@ -125,8 +125,108 @@ exports.staticCompanySection = (_a = {},
|
|
|
125
125
|
// },
|
|
126
126
|
],
|
|
127
127
|
_a);
|
|
128
|
-
exports.
|
|
128
|
+
exports.staticCustomerSection = (_b = {},
|
|
129
129
|
_b[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_INPUT_V1] = [
|
|
130
|
+
{
|
|
131
|
+
disabled: false,
|
|
132
|
+
enabled: true,
|
|
133
|
+
error: '',
|
|
134
|
+
handleOnChange: function () { return void 0; },
|
|
135
|
+
id: 'phone',
|
|
136
|
+
label: 'Phone',
|
|
137
|
+
order: 1,
|
|
138
|
+
placeholder: '03** - *****',
|
|
139
|
+
required: true,
|
|
140
|
+
type: 'text',
|
|
141
|
+
value: '',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
disabled: false,
|
|
145
|
+
enabled: true,
|
|
146
|
+
error: '',
|
|
147
|
+
handleOnChange: function () { return void 0; },
|
|
148
|
+
id: 'firstName',
|
|
149
|
+
label: 'First Name',
|
|
150
|
+
order: 3,
|
|
151
|
+
placeholder: 'John',
|
|
152
|
+
required: true,
|
|
153
|
+
type: 'text',
|
|
154
|
+
value: '',
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
disabled: false,
|
|
158
|
+
enabled: true,
|
|
159
|
+
error: '',
|
|
160
|
+
handleOnChange: function () { },
|
|
161
|
+
id: 'lastName',
|
|
162
|
+
label: 'Last Name',
|
|
163
|
+
order: 4,
|
|
164
|
+
placeholder: 'Doe',
|
|
165
|
+
required: true,
|
|
166
|
+
type: 'text',
|
|
167
|
+
value: '',
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
disabled: false,
|
|
171
|
+
enabled: true,
|
|
172
|
+
error: '',
|
|
173
|
+
handleOnChange: function () { },
|
|
174
|
+
id: 'email',
|
|
175
|
+
label: 'Email',
|
|
176
|
+
order: 2,
|
|
177
|
+
placeholder: 'xyz@company.com',
|
|
178
|
+
required: false,
|
|
179
|
+
type: 'text',
|
|
180
|
+
value: '',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
disabled: false,
|
|
184
|
+
enabled: true,
|
|
185
|
+
error: '',
|
|
186
|
+
handleOnChange: function () { },
|
|
187
|
+
id: 'city',
|
|
188
|
+
label: 'City',
|
|
189
|
+
order: 6,
|
|
190
|
+
placeholder: 'New York',
|
|
191
|
+
required: true,
|
|
192
|
+
type: 'text',
|
|
193
|
+
value: '',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
disabled: false,
|
|
197
|
+
enabled: true,
|
|
198
|
+
error: '',
|
|
199
|
+
handleOnChange: function () { },
|
|
200
|
+
id: 'address',
|
|
201
|
+
label: 'Address',
|
|
202
|
+
order: 5,
|
|
203
|
+
placeholder: 'xyz street .....',
|
|
204
|
+
required: false,
|
|
205
|
+
type: 'text',
|
|
206
|
+
value: '',
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
_b[form_schema_1.VISTA_FORM_ELEMENTS.COMBOBOX_V1] = [
|
|
210
|
+
{
|
|
211
|
+
enabled: true,
|
|
212
|
+
handleInputOnChange: function () { return void 0; },
|
|
213
|
+
handleOnBlur: function () { return void 0; },
|
|
214
|
+
handleOnChange: function () { },
|
|
215
|
+
label: 'Country',
|
|
216
|
+
listItems: [],
|
|
217
|
+
nodeQueryKey: 'countryQuery',
|
|
218
|
+
nodeSelectKey: 'country',
|
|
219
|
+
order: 7,
|
|
220
|
+
placeholder: '',
|
|
221
|
+
query: '',
|
|
222
|
+
required: true,
|
|
223
|
+
selectKey1: 'name',
|
|
224
|
+
selectedItem: { name: '' },
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
_b);
|
|
228
|
+
exports.staticPricingSection = (_c = {},
|
|
229
|
+
_c[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_INPUT_V1] = [
|
|
130
230
|
{
|
|
131
231
|
disabled: true,
|
|
132
232
|
enabled: true,
|
|
@@ -192,7 +292,7 @@ exports.staticPricingSection = (_b = {},
|
|
|
192
292
|
value: '',
|
|
193
293
|
},
|
|
194
294
|
],
|
|
195
|
-
|
|
295
|
+
_c[form_schema_1.VISTA_FORM_ELEMENTS.COMBOBOX_V1] = [
|
|
196
296
|
{
|
|
197
297
|
enabled: true,
|
|
198
298
|
handleInputOnChange: function () { return void 0; },
|
|
@@ -209,7 +309,7 @@ exports.staticPricingSection = (_b = {},
|
|
|
209
309
|
selectedItem: { taxName: '' },
|
|
210
310
|
},
|
|
211
311
|
],
|
|
212
|
-
|
|
312
|
+
_c[form_schema_1.VISTA_FORM_ELEMENTS.RADIO_V1] = [
|
|
213
313
|
{
|
|
214
314
|
description: 'Discount can either be applied as a fixed value or percentage value, select below to confirm.',
|
|
215
315
|
enabled: true,
|
|
@@ -235,9 +335,9 @@ exports.staticPricingSection = (_b = {},
|
|
|
235
335
|
],
|
|
236
336
|
},
|
|
237
337
|
],
|
|
238
|
-
|
|
239
|
-
exports.staticServiceSection = (
|
|
240
|
-
|
|
338
|
+
_c);
|
|
339
|
+
exports.staticServiceSection = (_d = {},
|
|
340
|
+
_d[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_INPUT_V1] = [
|
|
241
341
|
{
|
|
242
342
|
className: '',
|
|
243
343
|
disabled: false,
|
|
@@ -309,7 +409,7 @@ exports.staticServiceSection = (_c = {},
|
|
|
309
409
|
value: '',
|
|
310
410
|
},
|
|
311
411
|
],
|
|
312
|
-
|
|
412
|
+
_d[form_schema_1.VISTA_FORM_ELEMENTS.BUTTON_V1] = [
|
|
313
413
|
{
|
|
314
414
|
className: 'flex justify-center items-end',
|
|
315
415
|
enabled: true,
|
|
@@ -319,9 +419,9 @@ exports.staticServiceSection = (_c = {},
|
|
|
319
419
|
variant: vista_button_type_1.VISTA_BUTTON_VARIANT.ICON,
|
|
320
420
|
},
|
|
321
421
|
],
|
|
322
|
-
|
|
323
|
-
exports.staticProductSection = (
|
|
324
|
-
|
|
422
|
+
_d);
|
|
423
|
+
exports.staticProductSection = (_e = {},
|
|
424
|
+
_e[form_schema_1.VISTA_FORM_ELEMENTS.COMBOBOX_V1] = [
|
|
325
425
|
{
|
|
326
426
|
// className: 'col-span-2',
|
|
327
427
|
// selectKey2: '',
|
|
@@ -340,7 +440,7 @@ exports.staticProductSection = (_d = {},
|
|
|
340
440
|
selectedItem: { name: '' },
|
|
341
441
|
},
|
|
342
442
|
],
|
|
343
|
-
|
|
443
|
+
_e[form_schema_1.VISTA_FORM_ELEMENTS.TEXT_INPUT_V1] = [
|
|
344
444
|
{
|
|
345
445
|
className: '',
|
|
346
446
|
disabled: false,
|
|
@@ -384,7 +484,7 @@ exports.staticProductSection = (_d = {},
|
|
|
384
484
|
value: '',
|
|
385
485
|
},
|
|
386
486
|
],
|
|
387
|
-
|
|
487
|
+
_e[form_schema_1.VISTA_FORM_ELEMENTS.BUTTON_V1] = [
|
|
388
488
|
{
|
|
389
489
|
className: 'flex justify-center items-end',
|
|
390
490
|
enabled: true,
|
|
@@ -394,7 +494,7 @@ exports.staticProductSection = (_d = {},
|
|
|
394
494
|
variant: vista_button_type_1.VISTA_BUTTON_VARIANT.ICON,
|
|
395
495
|
},
|
|
396
496
|
],
|
|
397
|
-
|
|
497
|
+
_e);
|
|
398
498
|
exports.INVOICE_API_ROUTES = {
|
|
399
499
|
INVOICES: '/api/quotes-invoices',
|
|
400
500
|
INVOICE: '/api/quote-invoice',
|
|
@@ -99,12 +99,14 @@ var actions_1 = require("./actions");
|
|
|
99
99
|
var constants_1 = require("./constants");
|
|
100
100
|
var reducer_1 = require("./reducer");
|
|
101
101
|
var types_1 = require("./types");
|
|
102
|
+
var validate_1 = require("./validate");
|
|
102
103
|
var generate_toast_1 = require("@appcorp/app-corp-vista/utils/generate-toast");
|
|
103
104
|
var calculate_subtotal_1 = require("./calculate-subtotal");
|
|
104
105
|
var context_1 = require("@appcorp/stellar-solutions-product-module/base-modules/product/context");
|
|
105
106
|
var context_2 = require("@appcorp/stellar-solutions-company-module/base-modules/company/context");
|
|
106
107
|
var date_fns_1 = require("date-fns");
|
|
107
108
|
var calculate_total_1 = require("./calculate-total");
|
|
109
|
+
var util_functions_2 = require("@react-pakistan/util-functions");
|
|
108
110
|
var useInvoiceState = function () {
|
|
109
111
|
var _a = (0, react_1.useReducer)(reducer_1.invoiceReducer, reducer_1.initialInvoiceState), state = _a[0], dispatch = _a[1];
|
|
110
112
|
var products = (0, context_1.useProductStateContext)().products;
|
|
@@ -306,12 +308,20 @@ var useInvoiceState = function () {
|
|
|
306
308
|
type: actions_1.INVOICE_ACTION_TYPES.SET_DRAWER,
|
|
307
309
|
payload: { drawer: types_1.INVOICE_DRAWER.INVOICE_COMPANY_FORM_DRAWER },
|
|
308
310
|
});
|
|
311
|
+
dispatch({
|
|
312
|
+
type: actions_1.INVOICE_ACTION_TYPES.SET_FORM_TO_RENDER,
|
|
313
|
+
payload: { formToRender: 'company' },
|
|
314
|
+
});
|
|
309
315
|
}
|
|
310
316
|
if (text === 'customer') {
|
|
311
317
|
dispatch({
|
|
312
318
|
type: actions_1.INVOICE_ACTION_TYPES.SET_DRAWER,
|
|
313
319
|
payload: { drawer: types_1.INVOICE_DRAWER.INVOICE_CUSTOMER_FORM_DRAWER },
|
|
314
320
|
});
|
|
321
|
+
dispatch({
|
|
322
|
+
type: actions_1.INVOICE_ACTION_TYPES.SET_FORM_TO_RENDER,
|
|
323
|
+
payload: { formToRender: 'customer' },
|
|
324
|
+
});
|
|
315
325
|
}
|
|
316
326
|
};
|
|
317
327
|
var handleEdit = function (id) {
|
|
@@ -352,31 +362,29 @@ var useInvoiceState = function () {
|
|
|
352
362
|
// return urls;
|
|
353
363
|
// }, [state.images]);
|
|
354
364
|
var handleSubmit = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
365
|
+
var validationResult, validationErrors_1;
|
|
355
366
|
return __generator(this, function (_a) {
|
|
356
367
|
dispatch({
|
|
357
368
|
type: actions_1.INVOICE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
358
369
|
payload: { disableSaveButton: true },
|
|
359
370
|
});
|
|
360
371
|
try {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
body: JSON.stringify(__assign({}, updatedParams)),
|
|
378
|
-
});
|
|
379
|
-
// }
|
|
372
|
+
validationResult = validate_1.formValidation === null || validate_1.formValidation === void 0 ? void 0 : validate_1.formValidation.safeParse(__assign({}, updatedParams));
|
|
373
|
+
if (validationResult === null || validationResult === void 0 ? void 0 : validationResult.error) {
|
|
374
|
+
validationErrors_1 = {};
|
|
375
|
+
validationResult === null || validationResult === void 0 ? void 0 : validationResult.error.errors.forEach(function (err) {
|
|
376
|
+
validationErrors_1[err.path[0]] = err.message;
|
|
377
|
+
});
|
|
378
|
+
dispatch({
|
|
379
|
+
type: actions_1.INVOICE_ACTION_TYPES.SET_ERRORS,
|
|
380
|
+
payload: validationErrors_1,
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
if (validationResult === null || validationResult === void 0 ? void 0 : validationResult.success) {
|
|
384
|
+
updateFetchNow(undefined, {
|
|
385
|
+
body: JSON.stringify(__assign({}, updatedParams)),
|
|
386
|
+
});
|
|
387
|
+
}
|
|
380
388
|
}
|
|
381
389
|
catch (_b) {
|
|
382
390
|
(0, generate_toast_1.generateToast)({
|
|
@@ -492,7 +500,6 @@ var useInvoiceState = function () {
|
|
|
492
500
|
payload: { key: 'subTotal', value: subtotal },
|
|
493
501
|
});
|
|
494
502
|
}
|
|
495
|
-
console.log('updated', updatedItems);
|
|
496
503
|
dispatch({
|
|
497
504
|
type: actions_1.INVOICE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
498
505
|
payload: { key: 'products', value: updatedItems },
|
|
@@ -626,6 +633,41 @@ var useInvoiceState = function () {
|
|
|
626
633
|
}
|
|
627
634
|
return elements;
|
|
628
635
|
}, [state, handleChange, companies]);
|
|
636
|
+
var dynamicCustomerFormElements = (0, react_1.useMemo)(function () {
|
|
637
|
+
var _a, _b;
|
|
638
|
+
var elements = __assign({}, constants_1.staticCustomerSection);
|
|
639
|
+
var textInputElements = (_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; });
|
|
640
|
+
if (textInputElements) {
|
|
641
|
+
textInputElements[0].value = state.phone;
|
|
642
|
+
textInputElements[0].handleOnChange = handleChange;
|
|
643
|
+
textInputElements[0].error = state.errors.phone;
|
|
644
|
+
textInputElements[1].value = state.email;
|
|
645
|
+
textInputElements[1].handleOnChange = handleChange;
|
|
646
|
+
textInputElements[1].error = state.errors.email;
|
|
647
|
+
textInputElements[2].value = state.firstName;
|
|
648
|
+
textInputElements[2].handleOnChange = handleChange;
|
|
649
|
+
textInputElements[2].error = state.errors.firstName;
|
|
650
|
+
textInputElements[3].value = state.lastName;
|
|
651
|
+
textInputElements[3].handleOnChange = handleChange;
|
|
652
|
+
textInputElements[3].error = state.errors.lastName;
|
|
653
|
+
textInputElements[4].value = state.address;
|
|
654
|
+
textInputElements[4].handleOnChange = handleChange;
|
|
655
|
+
textInputElements[4].error = state.errors.address;
|
|
656
|
+
textInputElements[5].value = state.city;
|
|
657
|
+
textInputElements[5].handleOnChange = handleChange;
|
|
658
|
+
textInputElements[5].error = state.errors.city;
|
|
659
|
+
}
|
|
660
|
+
var comboboxElements = (_b = elements[form_schema_1.VISTA_FORM_ELEMENTS.COMBOBOX_V1]) === null || _b === void 0 ? void 0 : _b.sort(function (a, b) { return a.order - b.order; });
|
|
661
|
+
if (comboboxElements) {
|
|
662
|
+
comboboxElements[0].selectedItem = { id: state.country };
|
|
663
|
+
comboboxElements[0].listItems = util_functions_2.countriesTimeZones;
|
|
664
|
+
comboboxElements[0].query = state.countryQuery;
|
|
665
|
+
comboboxElements[0].handleOnChange = handleSelectChange;
|
|
666
|
+
comboboxElements[0].handleInputOnChange = handleChange;
|
|
667
|
+
comboboxElements[0].handleOnBlur = handleChange;
|
|
668
|
+
}
|
|
669
|
+
return elements;
|
|
670
|
+
}, [state, handleChange]);
|
|
629
671
|
var dynamicPricingFormElements = (0, react_1.useMemo)(function () {
|
|
630
672
|
var _a, _b, _c, _d, _e, _f;
|
|
631
673
|
var elements = __assign({}, constants_1.staticPricingSection);
|
|
@@ -675,113 +717,113 @@ var useInvoiceState = function () {
|
|
|
675
717
|
});
|
|
676
718
|
}
|
|
677
719
|
};
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
}, [state, handleItemChangeProducts, products, handleChange]);
|
|
720
|
+
// const dynamicServiceFormElements: VistaFormElements[] = useMemo(() => {
|
|
721
|
+
// const elements: VistaFormElements = { ...staticServiceSection };
|
|
722
|
+
// const servicesElements = state.services.map(() => ({
|
|
723
|
+
// ...elements,
|
|
724
|
+
// }));
|
|
725
|
+
// servicesElements?.map((element, i) => {
|
|
726
|
+
// const textInputElements: VistaTextInputV1Props[] | undefined = element[VISTA_FORM_ELEMENTS.TEXT_INPUT_V1]?.sort((a, b) => a.order - b.order);
|
|
727
|
+
// if (textInputElements) {
|
|
728
|
+
// textInputElements[0].value = state.services[i].name;
|
|
729
|
+
// textInputElements[0].handleOnChange = (k, v) => handleItemChangeServices({
|
|
730
|
+
// index: i,
|
|
731
|
+
// key: k as keyof Service,
|
|
732
|
+
// value: v,
|
|
733
|
+
// });
|
|
734
|
+
// textInputElements[1].value = state.services[i].description;
|
|
735
|
+
// textInputElements[1].handleOnChange = (k, v) => handleItemChangeServices({
|
|
736
|
+
// index: i,
|
|
737
|
+
// key: k as keyof Service,
|
|
738
|
+
// value: v,
|
|
739
|
+
// });
|
|
740
|
+
// textInputElements[2].value = state.services[i].quantity;
|
|
741
|
+
// textInputElements[2].handleOnChange = (k, v) => handleItemChangeServices({
|
|
742
|
+
// index: i,
|
|
743
|
+
// key: k as keyof Service,
|
|
744
|
+
// value: v,
|
|
745
|
+
// });
|
|
746
|
+
// textInputElements[3].value = state.services[i].price;
|
|
747
|
+
// textInputElements[3].handleOnChange = (k, v) => handleItemChangeServices({
|
|
748
|
+
// index: i,
|
|
749
|
+
// key: k as keyof Service,
|
|
750
|
+
// value: v,
|
|
751
|
+
// });
|
|
752
|
+
// textInputElements[4].value = state.services[i].rowTotal;
|
|
753
|
+
// }
|
|
754
|
+
// // state.services?.forEach((service, i) => {
|
|
755
|
+
// // textInputElements[i].error = state.errors[id];
|
|
756
|
+
// // textInputElements[i].error = state.errors[id];
|
|
757
|
+
// // textInputElements[i].error = state.errors[id];
|
|
758
|
+
// // textInputElements[i].error = state.errors[id];
|
|
759
|
+
// // textInputElements[i].error = state.errors[id];
|
|
760
|
+
// const buttonElements = element[VISTA_FORM_ELEMENTS.BUTTON_V1]?.sort((a, b) => a.order - b.order);
|
|
761
|
+
// if (buttonElements) {
|
|
762
|
+
// // state.services?.forEach((service, i) => {
|
|
763
|
+
// buttonElements[0].handleOnClick = () => {
|
|
764
|
+
// if (state.services.length > 1) {
|
|
765
|
+
// const res = state.services.splice(i, 1);
|
|
766
|
+
// dispatch({
|
|
767
|
+
// type: INVOICE_ACTION_TYPES.DELETE_ITEM_SERVICE,
|
|
768
|
+
// payload: { services: [...res] },
|
|
769
|
+
// });
|
|
770
|
+
// }
|
|
771
|
+
// }
|
|
772
|
+
// // });
|
|
773
|
+
// }
|
|
774
|
+
// });
|
|
775
|
+
// // }
|
|
776
|
+
// return servicesElements;
|
|
777
|
+
// }, [state.services, handleItemChangeServices]);
|
|
778
|
+
// const dynamicProductFormElements: VistaFormElements = useMemo(() => {
|
|
779
|
+
// const elements: VistaFormElements = { ...staticProductSection };
|
|
780
|
+
// const textInputElements: VistaTextInputV1Props[] | undefined = elements[VISTA_FORM_ELEMENTS.TEXT_INPUT_V1]?.sort((a, b) => a.order - b.order);
|
|
781
|
+
// if (textInputElements) {
|
|
782
|
+
// state.products?.forEach((product, i) => {
|
|
783
|
+
// textInputElements[0].value = String(product.quantity);
|
|
784
|
+
// textInputElements[0].handleOnChange = (k, v) => handleItemChangeProducts({
|
|
785
|
+
// index: i,
|
|
786
|
+
// key: k as keyof Product,
|
|
787
|
+
// value: Number(v),
|
|
788
|
+
// });
|
|
789
|
+
// // textInputElements[i].error = state.errors[id];
|
|
790
|
+
// textInputElements[2].value = product.rowTotal;
|
|
791
|
+
// });
|
|
792
|
+
// }
|
|
793
|
+
// const comboboxElements: VistaComboboxV1Props[] | undefined = elements[VISTA_FORM_ELEMENTS.COMBOBOX_V1]?.sort((a, b) => a.order - b.order);
|
|
794
|
+
// if (comboboxElements) {
|
|
795
|
+
// state.products?.forEach((product, i) => {
|
|
796
|
+
// comboboxElements[0].listItems = products;
|
|
797
|
+
// comboboxElements[0].query = state.productQuery;
|
|
798
|
+
// comboboxElements[0].handleInputOnChange = handleChange;
|
|
799
|
+
// comboboxElements[0].handleOnBlur = handleChange;
|
|
800
|
+
// comboboxElements[0].handleOnChange = (k, v: object) => {
|
|
801
|
+
// console.log('_>>>>>>>>>', k, v);
|
|
802
|
+
// const val = { ...v } as { id: string };
|
|
803
|
+
// handleItemChangeProducts({
|
|
804
|
+
// index: i,
|
|
805
|
+
// key: k as keyof Product,
|
|
806
|
+
// value: val.id,
|
|
807
|
+
// });
|
|
808
|
+
// }
|
|
809
|
+
// })
|
|
810
|
+
// }
|
|
811
|
+
// const buttonElements = elements[VISTA_FORM_ELEMENTS.BUTTON_V1]?.sort((a, b) => a.order - b.order);
|
|
812
|
+
// if (buttonElements) {
|
|
813
|
+
// state.products?.forEach((product, i) => {
|
|
814
|
+
// buttonElements[0].handleOnClick = () => {
|
|
815
|
+
// if (state.products.length > 1) {
|
|
816
|
+
// const res = state.products.splice(i, 1);
|
|
817
|
+
// dispatch({
|
|
818
|
+
// type: INVOICE_ACTION_TYPES.DELETE_ITEM_PRODUCT,
|
|
819
|
+
// payload: { products: [...res] },
|
|
820
|
+
// });
|
|
821
|
+
// }
|
|
822
|
+
// }
|
|
823
|
+
// });
|
|
824
|
+
// }
|
|
825
|
+
// return elements;
|
|
826
|
+
// }, [state, handleItemChangeProducts, products, handleChange]);
|
|
785
827
|
var headerActions = [
|
|
786
828
|
{
|
|
787
829
|
enabled: true,
|
|
@@ -810,11 +852,17 @@ var useInvoiceState = function () {
|
|
|
810
852
|
order: 2,
|
|
811
853
|
},
|
|
812
854
|
];
|
|
813
|
-
return __assign(__assign({}, state), { byIdError: byIdError, byIdLoading: byIdLoading, clearSearch: clearSearch, closeDrawer: closeDrawer, deleteError: deleteError, deleteLoading: deleteLoading, dispatch: dispatch, dynamicCompanyFormElements: dynamicCompanyFormElements, dynamicPricingFormElements: dynamicPricingFormElements,
|
|
855
|
+
return __assign(__assign({}, state), { byIdError: byIdError, byIdLoading: byIdLoading, clearSearch: clearSearch, closeDrawer: closeDrawer, deleteError: deleteError, deleteLoading: deleteLoading, dispatch: dispatch, dynamicCompanyFormElements: dynamicCompanyFormElements, dynamicPricingFormElements: dynamicPricingFormElements,
|
|
856
|
+
// dynamicProductFormElements,
|
|
857
|
+
// dynamicServiceFormElements,
|
|
858
|
+
dynamicCustomerFormElements: dynamicCustomerFormElements, handleChange: handleChange, handleNextClick: handleNextClick, handlePageLimit: handlePageLimit, handlePreviousClick: handlePreviousClick, handleSubmit: handleSubmit,
|
|
814
859
|
// handleUploadImage,
|
|
815
860
|
headerActions: headerActions, listError: listError, listFetchNow: listFetchNow, listLoading: listLoading, rowActions: rowActions, searchOnChange: searchOnChange, updateError: updateError, updateLoading: updateLoading, handleAddItemService: handleAddItemService, handleAddItemProduct: handleAddItemProduct, handleItemChangeServices: handleItemChangeServices, handleDeleteServiceRow: handleDeleteServiceRow, handleItemChangeProducts: handleItemChangeProducts, handleDeleteProductRow: handleDeleteProductRow });
|
|
816
861
|
};
|
|
817
|
-
exports.InvoiceStateContext = (0, react_1.createContext)(__assign(__assign({}, reducer_1.initialInvoiceState), { byIdError: undefined, byIdLoading: false, clearSearch: function () { return void 0; }, closeDrawer: function () { return void 0; }, deleteError: undefined, deleteLoading: false, dispatch: function () { return void 0; }, dynamicCompanyFormElements: {}, dynamicPricingFormElements: {},
|
|
862
|
+
exports.InvoiceStateContext = (0, react_1.createContext)(__assign(__assign({}, reducer_1.initialInvoiceState), { byIdError: undefined, byIdLoading: false, clearSearch: function () { return void 0; }, closeDrawer: function () { return void 0; }, deleteError: undefined, deleteLoading: false, dispatch: function () { return void 0; }, dynamicCompanyFormElements: {}, dynamicPricingFormElements: {},
|
|
863
|
+
// dynamicProductFormElements: {},
|
|
864
|
+
// dynamicServiceFormElements: [],
|
|
865
|
+
dynamicCustomerFormElements: {}, handleChange: function () { return void 0; }, handleNextClick: function () { return void 0; }, handlePageLimit: function () { return void 0; }, handlePreviousClick: function () { return void 0; }, handleSubmit: function () { return void 0; },
|
|
818
866
|
// handleUploadImage: () => void 0,
|
|
819
867
|
headerActions: [], listError: undefined, listFetchNow: function () { return void 0; }, listLoading: false, rowActions: [], searchOnChange: function () { return void 0; }, updateError: undefined, updateLoading: false, handleAddItemService: function () { return void 0; }, handleAddItemProduct: function () { return void 0; }, handleItemChangeServices: function () { return void 0; }, handleDeleteServiceRow: function () { return void 0; }, handleItemChangeProducts: function () { return void 0; }, handleDeleteProductRow: function () { return void 0; } }));
|
|
820
868
|
var InvoiceStateContextProvider = function (_a) {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.renderCustomerFormElements = void 0;
|
|
19
|
+
var react_1 = __importDefault(require("react"));
|
|
20
|
+
var form_schema_1 = require("@appcorp/app-corp-vista/utils/form-schema");
|
|
21
|
+
var renderCustomerFormElements = function (elementProps) {
|
|
22
|
+
var _a;
|
|
23
|
+
var elementsArray = (_a = Object.entries(form_schema_1.vistaFormSchema)
|
|
24
|
+
.flatMap(function (_a) {
|
|
25
|
+
var _b, _c;
|
|
26
|
+
var key = _a[0], config = _a[1];
|
|
27
|
+
var Component = config;
|
|
28
|
+
return (_c = (_b = (elementProps[key] || [])) === null || _b === void 0 ? void 0 : _b.filter(function (props) { return props.enabled; })) === null || _c === void 0 ? void 0 : _c.map(function (props) { return ({
|
|
29
|
+
Component: Component,
|
|
30
|
+
key: key,
|
|
31
|
+
order: props.order,
|
|
32
|
+
props: props,
|
|
33
|
+
}); });
|
|
34
|
+
})) === null || _a === void 0 ? void 0 : _a.sort(function (a, b) { return a.order - b.order; });
|
|
35
|
+
return (react_1.default.createElement("div", { className: "grid grid-cols-4 gap-4" }, elementsArray === null || elementsArray === void 0 ? void 0 : elementsArray.map(function (_a, index) {
|
|
36
|
+
var key = _a.key, Component = _a.Component, props = _a.props;
|
|
37
|
+
return (react_1.default.createElement("div", { key: "".concat(key, "-").concat(index) },
|
|
38
|
+
react_1.default.createElement(Component, __assign({}, props))));
|
|
39
|
+
})));
|
|
40
|
+
};
|
|
41
|
+
exports.renderCustomerFormElements = renderCustomerFormElements;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CustomerSection = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var vista_vertical_divider_v4_1 = require("@appcorp/app-corp-vista/molecules/vista-vertical-divider-v4");
|
|
9
|
+
var customer_form_elements_1 = require("./customer-form-elements");
|
|
10
|
+
var context_1 = require("./context");
|
|
11
|
+
var CustomerSection = function () {
|
|
12
|
+
var dynamicCustomerFormElements = (0, context_1.useInvoiceStateContext)().dynamicCustomerFormElements;
|
|
13
|
+
return (react_1.default.createElement("div", { className: "flex flex-col gap-4" },
|
|
14
|
+
react_1.default.createElement(vista_vertical_divider_v4_1.VistaVerticalDividerV4, { label: "Customer" }),
|
|
15
|
+
(0, customer_form_elements_1.renderCustomerFormElements)(dynamicCustomerFormElements)));
|
|
16
|
+
};
|
|
17
|
+
exports.CustomerSection = CustomerSection;
|
|
@@ -5,62 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.InvoiceForm = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
|
-
// import { VistaUploadV1Props } from '@appcorp/app-corp-vista/type/vista-upload-type';
|
|
9
|
-
// import { VistaTextInputV1Props } from '@appcorp/app-corp-vista/type/vista-text-input-type';
|
|
10
|
-
// import { VistaTextAreaV1Props } from '@appcorp/app-corp-vista/type/vista-text-area-type';
|
|
11
|
-
// import { VistaSelectV1Props } from '@appcorp/app-corp-vista/type/vista-select-type';
|
|
12
|
-
// import { VistaFormElements } from '@appcorp/app-corp-vista/type/vista-form-elements';
|
|
13
|
-
// import { VistaComboboxV1Props } from '@appcorp/app-corp-vista/type/vista-combobox-type';
|
|
14
|
-
// import { VISTA_FORM_ELEMENTS } from '@appcorp/app-corp-vista/utils/form-schema';
|
|
15
|
-
// import { useInvoiceStateContext } from './context';
|
|
16
|
-
// import { renderProductFormElements } from './form-elements';
|
|
17
8
|
var products_form_section_1 = require("./products-form-section");
|
|
18
9
|
var pricing_form_section_1 = require("./pricing-form-section");
|
|
19
10
|
var add_service_product_section_1 = require("./add-service-product-section");
|
|
20
11
|
var services_form_section_1 = require("./services-form-section");
|
|
21
12
|
var company_form_section_1 = require("./company-form-section");
|
|
13
|
+
var context_1 = require("./context");
|
|
14
|
+
var customer_form_section_1 = require("./customer-form-section");
|
|
22
15
|
var InvoiceForm = function () {
|
|
23
|
-
|
|
24
|
-
// const elements: VistaFormElements = { ...dynamicFormElements };
|
|
25
|
-
// const textInputElements: VistaTextInputV1Props[] | undefined = elements[VISTA_FORM_ELEMENTS.TEXT_INPUT_V1]?.sort((a, b) => a.order - b.order);
|
|
26
|
-
// if (textInputElements) {
|
|
27
|
-
// textInputElements?.forEach(({ label }, i) => {
|
|
28
|
-
// if (translationMap[label as string] === undefined) return label;
|
|
29
|
-
// textInputElements[i].label = translationMap[label as string];
|
|
30
|
-
// });
|
|
31
|
-
// }
|
|
32
|
-
// const textAreaElements: VistaTextAreaV1Props[] | undefined = elements[VISTA_FORM_ELEMENTS.TEXT_AREA_V1]?.sort((a, b) => a.order - b.order);
|
|
33
|
-
// if (textAreaElements) {
|
|
34
|
-
// textAreaElements?.forEach(({ label }, i) => {
|
|
35
|
-
// if (translationMap[label as string] === undefined) return label;
|
|
36
|
-
// textAreaElements[i].label = translationMap[label];
|
|
37
|
-
// });
|
|
38
|
-
// }
|
|
39
|
-
// const selectElements: VistaSelectV1Props[] | undefined = elements[VISTA_FORM_ELEMENTS.SELECT_V1]?.sort((a, b) => a.order - b.order);
|
|
40
|
-
// if (selectElements) {
|
|
41
|
-
// selectElements?.forEach(({ label }, i) => {
|
|
42
|
-
// if (translationMap[label as string] === undefined) return label;
|
|
43
|
-
// selectElements[i].label = translationMap[label as string];
|
|
44
|
-
// });
|
|
45
|
-
// }
|
|
46
|
-
// const comboboxElements: VistaComboboxV1Props[] | undefined = elements[VISTA_FORM_ELEMENTS.COMBOBOX_V1]?.sort((a, b) => a.order - b.order);
|
|
47
|
-
// if (comboboxElements) {
|
|
48
|
-
// comboboxElements?.forEach(({ label }, i) => {
|
|
49
|
-
// if (translationMap[label as string] === undefined) return label;
|
|
50
|
-
// comboboxElements[i].label = translationMap[label as string];
|
|
51
|
-
// });
|
|
52
|
-
// }
|
|
53
|
-
// const uploadElements: VistaUploadV1Props[] | undefined = elements[VISTA_FORM_ELEMENTS.UPLOAD_V1]?.sort((a, b) => a.order - b.order);
|
|
54
|
-
// if (uploadElements) {
|
|
55
|
-
// uploadElements?.forEach(({ label }, i) => {
|
|
56
|
-
// if (translationMap[label as string] === undefined) return label;
|
|
57
|
-
// uploadElements[i].label = translationMap[label as string];
|
|
58
|
-
// });
|
|
59
|
-
// }
|
|
60
|
-
// return elements;
|
|
61
|
-
// }, [dynamicFormElements, translationMap]);
|
|
16
|
+
var formToRender = (0, context_1.useInvoiceStateContext)().formToRender;
|
|
62
17
|
return (react_1.default.createElement("div", { className: "flex flex-col gap-8" },
|
|
63
|
-
react_1.default.createElement(
|
|
18
|
+
formToRender === 'customer' && (react_1.default.createElement(customer_form_section_1.CustomerSection, null)),
|
|
19
|
+
formToRender === 'company' && (react_1.default.createElement(company_form_section_1.CompanySection, null)),
|
|
64
20
|
react_1.default.createElement(services_form_section_1.ServicesSection, null),
|
|
65
21
|
react_1.default.createElement(products_form_section_1.ProductsSection, null),
|
|
66
22
|
react_1.default.createElement(add_service_product_section_1.AddServiceProductSection, null),
|
|
@@ -30,11 +30,13 @@ exports.initialInvoiceState = {
|
|
|
30
30
|
address: '',
|
|
31
31
|
category: types_1.QUOTE_INVOICE.INVOICE,
|
|
32
32
|
city: '',
|
|
33
|
+
formToRender: '',
|
|
33
34
|
companyId: '',
|
|
34
35
|
companyQuery: '',
|
|
35
36
|
productQuery: '',
|
|
36
37
|
count: 0,
|
|
37
38
|
country: '',
|
|
39
|
+
countryQuery: '',
|
|
38
40
|
currency: 'PKR',
|
|
39
41
|
currentPage: 1,
|
|
40
42
|
customerId: '',
|
|
@@ -150,6 +152,8 @@ function invoiceReducer(state, action) {
|
|
|
150
152
|
return __assign(__assign({}, state), { services: __spreadArray([], action.payload.services, true) });
|
|
151
153
|
case actions_1.INVOICE_ACTION_TYPES.DELETE_ITEM_PRODUCT:
|
|
152
154
|
return __assign(__assign({}, state), { products: __spreadArray([], action.payload.products, true) });
|
|
155
|
+
case actions_1.INVOICE_ACTION_TYPES.SET_FORM_TO_RENDER:
|
|
156
|
+
return __assign(__assign({}, state), { formToRender: action.payload.formToRender });
|
|
153
157
|
default:
|
|
154
158
|
return state;
|
|
155
159
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { RowActionItem } from '@appcorp/app-corp-vista/type/vista-dropdown-menu-type';
|
|
2
2
|
import { VistaTableHeaderActionItem } from '@appcorp/app-corp-vista/type/vista-table-type';
|
|
3
3
|
import { VistaFormElements } from '@appcorp/app-corp-vista/type/vista-form-elements';
|
|
4
|
+
import { CompanyTypeBE } from '@appcorp/stellar-solutions-company-module/base-modules/company/types';
|
|
4
5
|
import { Dispatch } from 'react';
|
|
5
6
|
import { InvoiceActions } from './actions';
|
|
6
|
-
import { CompanyTypeBE } from '@appcorp/stellar-solutions-company-module/base-modules/company/types';
|
|
7
7
|
export interface InvoiceContextType {
|
|
8
8
|
byIdError?: Error;
|
|
9
9
|
byIdLoading: boolean;
|
|
@@ -13,9 +13,8 @@ export interface InvoiceContextType {
|
|
|
13
13
|
deleteLoading: boolean;
|
|
14
14
|
dispatch: Dispatch<InvoiceActions>;
|
|
15
15
|
dynamicCompanyFormElements: VistaFormElements;
|
|
16
|
+
dynamicCustomerFormElements: VistaFormElements;
|
|
16
17
|
dynamicPricingFormElements: VistaFormElements;
|
|
17
|
-
dynamicProductFormElements: VistaFormElements;
|
|
18
|
-
dynamicServiceFormElements: VistaFormElements[];
|
|
19
18
|
handleAddItemProduct: () => void;
|
|
20
19
|
handleAddItemService: () => void;
|
|
21
20
|
handleChange: (field: string, value: string | number | number[]) => void;
|
|
@@ -120,11 +119,12 @@ export interface InvoiceTypeBE {
|
|
|
120
119
|
}
|
|
121
120
|
export interface InvoiceState extends Omit<InvoiceTypeBE, 'createdAt' | 'updatedAt'> {
|
|
122
121
|
address: string;
|
|
122
|
+
afterDiscount: string;
|
|
123
123
|
city: string;
|
|
124
124
|
companyQuery: string;
|
|
125
|
-
productQuery: string;
|
|
126
125
|
count: number;
|
|
127
126
|
country: string;
|
|
127
|
+
countryQuery: string;
|
|
128
128
|
currentPage: number;
|
|
129
129
|
disableSaveButton: boolean;
|
|
130
130
|
drawer: null | INVOICE_DRAWER;
|
|
@@ -133,6 +133,7 @@ export interface InvoiceState extends Omit<InvoiceTypeBE, 'createdAt' | 'updated
|
|
|
133
133
|
[key: string]: string;
|
|
134
134
|
};
|
|
135
135
|
firstName: string;
|
|
136
|
+
formToRender: string;
|
|
136
137
|
invoices: InvoiceTypeBE[];
|
|
137
138
|
lastName: string;
|
|
138
139
|
loading: boolean;
|
|
@@ -141,9 +142,9 @@ export interface InvoiceState extends Omit<InvoiceTypeBE, 'createdAt' | 'updated
|
|
|
141
142
|
netTotal: string;
|
|
142
143
|
pageLimit: number;
|
|
143
144
|
phone: string;
|
|
145
|
+
productQuery: string;
|
|
144
146
|
products: Product[];
|
|
145
147
|
searchQuery: string;
|
|
146
|
-
afterDiscount: string;
|
|
147
148
|
tax: string;
|
|
148
149
|
}
|
|
149
150
|
export interface FetchInvoicesArgs {
|