@appcorp/stellar-solutions-invoice-module 0.1.55 → 0.1.57
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/add-service-product-section.d.ts +12 -2
- package/base-modules/invoice/add-service-product-section.js +20 -10
- package/base-modules/invoice/company-form-section.d.ts +12 -2
- package/base-modules/invoice/company-form-section.js +118 -10
- package/base-modules/invoice/constants.d.ts +18 -25
- package/base-modules/invoice/constants.js +66 -548
- package/base-modules/invoice/context.d.ts +42 -2
- package/base-modules/invoice/context.js +259 -317
- package/base-modules/invoice/customer-form-section.d.ts +12 -2
- package/base-modules/invoice/customer-form-section.js +91 -9
- package/base-modules/invoice/drawer.d.ts +9 -4
- package/base-modules/invoice/drawer.js +32 -6
- package/base-modules/invoice/form.d.ts +2 -4
- package/base-modules/invoice/form.js +7 -6
- package/base-modules/invoice/invoice.d.ts +2 -2
- package/base-modules/invoice/invoice.js +33 -42
- package/base-modules/invoice/pricing-form-section.d.ts +12 -2
- package/base-modules/invoice/pricing-form-section.js +65 -9
- package/base-modules/invoice/products-form-section.d.ts +12 -2
- package/base-modules/invoice/products-form-section.js +57 -31
- package/base-modules/invoice/reducer.d.ts +2 -2
- package/base-modules/invoice/reducer.js +57 -56
- package/base-modules/invoice/services-form-section.d.ts +12 -2
- package/base-modules/invoice/services-form-section.js +61 -14
- package/base-modules/invoice/types.d.ts +43 -23
- package/base-modules/invoice/validate.d.ts +869 -17
- package/base-modules/invoice/validate.js +94 -35
- package/base-modules/quote/actions.d.ts +215 -0
- package/base-modules/quote/actions.js +38 -0
- package/base-modules/quote/add-service-product-section.d.ts +12 -0
- package/base-modules/quote/add-service-product-section.js +31 -0
- package/base-modules/quote/calculate-subtotal.d.ts +1 -0
- package/base-modules/quote/calculate-subtotal.js +6 -0
- package/base-modules/quote/calculate-total.d.ts +1 -0
- package/base-modules/quote/calculate-total.js +6 -0
- package/base-modules/quote/company-form-section.d.ts +12 -0
- package/base-modules/quote/company-form-section.js +125 -0
- package/base-modules/quote/constants.d.ts +64 -0
- package/base-modules/quote/constants.js +107 -0
- package/base-modules/quote/context.d.ts +50 -0
- package/base-modules/quote/context.js +822 -0
- package/base-modules/quote/customer-form-section.d.ts +12 -0
- package/base-modules/quote/customer-form-section.js +99 -0
- package/base-modules/quote/drawer.d.ts +13 -0
- package/base-modules/quote/drawer.js +45 -0
- package/base-modules/quote/form.d.ts +6 -0
- package/base-modules/quote/form.js +27 -0
- package/base-modules/quote/pricing-form-section.d.ts +12 -0
- package/base-modules/quote/pricing-form-section.js +76 -0
- package/base-modules/quote/products-form-section.d.ts +12 -0
- package/base-modules/quote/products-form-section.js +71 -0
- package/base-modules/quote/quote.d.ts +8 -0
- package/base-modules/quote/quote.js +69 -0
- package/base-modules/quote/reducer.d.ts +4 -0
- package/base-modules/quote/reducer.js +181 -0
- package/base-modules/quote/services-form-section.d.ts +12 -0
- package/base-modules/quote/services-form-section.js +73 -0
- package/base-modules/quote/types.d.ts +126 -0
- package/base-modules/quote/types.js +35 -0
- package/base-modules/quote/validate.d.ts +856 -0
- package/base-modules/quote/validate.js +85 -0
- package/package.json +23 -8
- package/base-modules/invoice/company-form-elements.d.ts +0 -3
- package/base-modules/invoice/company-form-elements.js +0 -41
- package/base-modules/invoice/customer-form-elements.d.ts +0 -3
- package/base-modules/invoice/customer-form-elements.js +0 -41
- package/base-modules/invoice/pricing-form-elements.d.ts +0 -3
- package/base-modules/invoice/pricing-form-elements.js +0 -41
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.quoteReducer = exports.initialQuoteState = void 0;
|
|
24
|
+
var actions_1 = require("./actions");
|
|
25
|
+
var types_1 = require("./types");
|
|
26
|
+
var types_2 = require("./types");
|
|
27
|
+
var date_fns_1 = require("date-fns");
|
|
28
|
+
var pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT) || 10;
|
|
29
|
+
exports.initialQuoteState = {
|
|
30
|
+
afterDiscount: "0",
|
|
31
|
+
category: types_2.QUOTE_INVOICE_CATEGORY.QUOTE,
|
|
32
|
+
companyId: "",
|
|
33
|
+
companyQuery: "",
|
|
34
|
+
count: 0,
|
|
35
|
+
countryQuery: "",
|
|
36
|
+
currency: "",
|
|
37
|
+
services: [],
|
|
38
|
+
customer: {
|
|
39
|
+
address: "",
|
|
40
|
+
city: "",
|
|
41
|
+
country: "",
|
|
42
|
+
createdAt: "",
|
|
43
|
+
email: "",
|
|
44
|
+
firstName: "",
|
|
45
|
+
id: "",
|
|
46
|
+
lastName: "",
|
|
47
|
+
phone: "",
|
|
48
|
+
updatedAt: "",
|
|
49
|
+
quotesInvoices: [],
|
|
50
|
+
},
|
|
51
|
+
contactsList: [],
|
|
52
|
+
currentPage: 1,
|
|
53
|
+
customerId: "",
|
|
54
|
+
date: new Date().toISOString(),
|
|
55
|
+
disableSaveButton: false,
|
|
56
|
+
discount: "0",
|
|
57
|
+
discountUnit: types_1.DISCOUNT_UNIT.FIXED_VALUE,
|
|
58
|
+
drawer: null,
|
|
59
|
+
errors: {},
|
|
60
|
+
expiryDate: (0, date_fns_1.addDays)(new Date(), 7).toISOString(),
|
|
61
|
+
id: "",
|
|
62
|
+
invoiceStatus: types_2.INVOICE_STATUS.UNPAID,
|
|
63
|
+
quotes: [],
|
|
64
|
+
loading: true,
|
|
65
|
+
getProducts: [],
|
|
66
|
+
modal: null,
|
|
67
|
+
mode: "Create",
|
|
68
|
+
netTotal: "",
|
|
69
|
+
note: "",
|
|
70
|
+
pageLimit: pageLimit,
|
|
71
|
+
payments: [],
|
|
72
|
+
companiesList: [],
|
|
73
|
+
productQuery: "",
|
|
74
|
+
quoteStatus: types_2.QUOTE_STATUS.DRAFT,
|
|
75
|
+
ref: "",
|
|
76
|
+
searchQuery: "",
|
|
77
|
+
subTotal: "",
|
|
78
|
+
tax: "",
|
|
79
|
+
taxRate: "",
|
|
80
|
+
taxQuery: "",
|
|
81
|
+
taxes: [],
|
|
82
|
+
total: "",
|
|
83
|
+
products: [],
|
|
84
|
+
company: {
|
|
85
|
+
name: "",
|
|
86
|
+
country: "",
|
|
87
|
+
createdAt: "",
|
|
88
|
+
updatedAt: "",
|
|
89
|
+
id: "",
|
|
90
|
+
phone: "",
|
|
91
|
+
email: "",
|
|
92
|
+
website: "",
|
|
93
|
+
contacts: [],
|
|
94
|
+
quotesInvoices: [],
|
|
95
|
+
},
|
|
96
|
+
servicesList: [
|
|
97
|
+
{
|
|
98
|
+
description: "",
|
|
99
|
+
mode: "Create",
|
|
100
|
+
name: "",
|
|
101
|
+
price: "",
|
|
102
|
+
quantity: "1",
|
|
103
|
+
rowTotal: "",
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
productsList: [
|
|
107
|
+
{
|
|
108
|
+
id: "",
|
|
109
|
+
mode: "Create",
|
|
110
|
+
price: "",
|
|
111
|
+
quantity: "1",
|
|
112
|
+
rowTotal: "",
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
};
|
|
116
|
+
var quoteReducer = function (state, action) {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
switch (action.type) {
|
|
119
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_DRAWER:
|
|
120
|
+
return __assign(__assign({}, state), { drawer: action.payload.drawer });
|
|
121
|
+
case actions_1.QUOTE_ACTION_TYPES.RESET_ERRORS:
|
|
122
|
+
return __assign(__assign({}, state), { errors: {} });
|
|
123
|
+
case actions_1.QUOTE_ACTION_TYPES.RESET_FORM:
|
|
124
|
+
return __assign(__assign(__assign(__assign({}, state), (state.customer && {
|
|
125
|
+
customer: __assign({}, exports.initialQuoteState.customer),
|
|
126
|
+
})), (state.company && {
|
|
127
|
+
company: __assign({}, exports.initialQuoteState.company),
|
|
128
|
+
})), { productsList: __spreadArray([], exports.initialQuoteState.productsList, true), servicesList: __spreadArray([], exports.initialQuoteState.servicesList, true), subTotal: exports.initialQuoteState.subTotal, discount: exports.initialQuoteState.discount, discountUnit: exports.initialQuoteState.discountUnit, afterDiscount: exports.initialQuoteState.afterDiscount, tax: exports.initialQuoteState.tax, total: exports.initialQuoteState.total, category: exports.initialQuoteState.category, companyId: exports.initialQuoteState.companyId, companyQuery: exports.initialQuoteState.companyQuery, countryQuery: exports.initialQuoteState.countryQuery, currency: exports.initialQuoteState.currency, contactsList: exports.initialQuoteState.contactsList, customerId: exports.initialQuoteState.customerId, date: exports.initialQuoteState.date, disableSaveButton: exports.initialQuoteState.disableSaveButton, expiryDate: exports.initialQuoteState.expiryDate, id: exports.initialQuoteState.id, invoiceStatus: exports.initialQuoteState.invoiceStatus, loading: exports.initialQuoteState.loading, getProducts: exports.initialQuoteState.getProducts, mode: exports.initialQuoteState.mode, netTotal: exports.initialQuoteState.netTotal, note: exports.initialQuoteState.note, payments: exports.initialQuoteState.payments, companiesList: exports.initialQuoteState.companiesList, productQuery: exports.initialQuoteState.productQuery, taxRate: exports.initialQuoteState.taxRate, taxQuery: exports.initialQuoteState.taxQuery, taxes: exports.initialQuoteState.taxes });
|
|
129
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON:
|
|
130
|
+
return __assign(__assign({}, state), { disableSaveButton: action.payload.disableSaveButton });
|
|
131
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_CURRENT_PAGE:
|
|
132
|
+
return __assign(__assign({}, state), { currentPage: action.payload.currentPage });
|
|
133
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_COUNT:
|
|
134
|
+
return __assign(__assign({}, state), { count: action.payload.count });
|
|
135
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_ERRORS:
|
|
136
|
+
return __assign(__assign({}, state), { disableSaveButton: false, errors: __assign({}, action.payload.errors) });
|
|
137
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_INPUT_FIELD:
|
|
138
|
+
return __assign(__assign({}, state), (_a = {}, _a[action.payload.key] = action.payload.value, _a));
|
|
139
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_PAGE_LIMIT:
|
|
140
|
+
return __assign(__assign({}, state), { pageLimit: action.payload.pageLimit });
|
|
141
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_QUOTES:
|
|
142
|
+
return __assign(__assign({}, state), { quotes: __spreadArray([], action.payload.quotes, true) });
|
|
143
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_SEARCH_QUERY:
|
|
144
|
+
return __assign(__assign({}, state), { searchQuery: action.payload.searchQuery });
|
|
145
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_FORM:
|
|
146
|
+
return __assign(__assign({}, state), action.payload.form);
|
|
147
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_DRAWER:
|
|
148
|
+
return __assign(__assign({}, state), { drawer: action.payload.drawer });
|
|
149
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_MODAL:
|
|
150
|
+
return __assign(__assign({}, state), { modal: action.payload.modal });
|
|
151
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_DISCOUNT_UNIT:
|
|
152
|
+
return __assign(__assign({}, state), { discountUnit: action.payload.discountUnit });
|
|
153
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_AFTER_DISCOUNT:
|
|
154
|
+
return __assign(__assign({}, state), { afterDiscount: action.payload.afterDiscount });
|
|
155
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_TAX:
|
|
156
|
+
return __assign(__assign({}, state), { tax: action.payload.tax });
|
|
157
|
+
case actions_1.QUOTE_ACTION_TYPES.ADD_ITEM_SERVICE:
|
|
158
|
+
return __assign(__assign({}, state), { servicesList: __spreadArray([], action.payload.servicesList, true) });
|
|
159
|
+
case actions_1.QUOTE_ACTION_TYPES.ADD_ITEM_PRODUCT:
|
|
160
|
+
return __assign(__assign({}, state), { productsList: __spreadArray([], action.payload.productsList, true) });
|
|
161
|
+
case actions_1.QUOTE_ACTION_TYPES.DELETE_ITEM_SERVICE:
|
|
162
|
+
return __assign(__assign({}, state), { servicesList: __spreadArray([], action.payload.servicesList, true) });
|
|
163
|
+
case actions_1.QUOTE_ACTION_TYPES.DELETE_ITEM_PRODUCT:
|
|
164
|
+
return __assign(__assign({}, state), { productsList: __spreadArray([], action.payload.productsList, true) });
|
|
165
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_PRODUCTS_LIST:
|
|
166
|
+
return __assign(__assign({}, state), { getProducts: __spreadArray([], action.payload.list, true) });
|
|
167
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_CUSTOMER:
|
|
168
|
+
return __assign(__assign({}, state), { customerId: action.payload.customerId, customer: __assign(__assign({}, state.customer), action.payload.customer) });
|
|
169
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_CUSTOMER_FORM:
|
|
170
|
+
return __assign(__assign({}, state), (state.customer && {
|
|
171
|
+
customer: __assign(__assign({}, state.customer), (_b = {}, _b[action.payload.key] = action.payload.value, _b)),
|
|
172
|
+
}));
|
|
173
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_TAXES:
|
|
174
|
+
return __assign(__assign({}, state), { taxes: __spreadArray([], action.payload.taxes, true) });
|
|
175
|
+
case actions_1.QUOTE_ACTION_TYPES.SET_COMPANIES_LIST:
|
|
176
|
+
return __assign(__assign({}, state), { companiesList: __spreadArray([], action.payload.companiesList, true) });
|
|
177
|
+
default:
|
|
178
|
+
return state;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
exports.quoteReducer = quoteReducer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Services Form Section Component
|
|
3
|
+
*
|
|
4
|
+
* Dynamic list of service rows for invoice creation/editing.
|
|
5
|
+
* Uses Shadcn UI components with RTL support and i18n.
|
|
6
|
+
*/
|
|
7
|
+
import { FC } from "react";
|
|
8
|
+
interface Props {
|
|
9
|
+
isRTL?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const ServicesSection: FC<Props>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Services Form Section Component
|
|
4
|
+
*
|
|
5
|
+
* Dynamic list of service rows for invoice creation/editing.
|
|
6
|
+
* Uses Shadcn UI components with RTL support and i18n.
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ServicesSection = void 0;
|
|
13
|
+
var react_1 = __importDefault(require("react"));
|
|
14
|
+
var next_intl_1 = require("next-intl");
|
|
15
|
+
var lucide_react_1 = require("lucide-react");
|
|
16
|
+
var button_1 = require("@appcorp/shadcn/components/button");
|
|
17
|
+
var input_1 = require("@appcorp/shadcn/components/input");
|
|
18
|
+
var context_1 = require("./context");
|
|
19
|
+
var ServicesSection = function () {
|
|
20
|
+
var t = (0, next_intl_1.useTranslations)("invoicePage");
|
|
21
|
+
var _a = (0, context_1.useQuoteStateContext)(), errors = _a.errors, handleDeleteServiceRow = _a.handleDeleteServiceRow, handleItemChangeServices = _a.handleItemChangeServices, servicesList = _a.servicesList;
|
|
22
|
+
if (!servicesList || servicesList.length === 0) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return (react_1.default.createElement("div", { className: "flex flex-col gap-4" },
|
|
26
|
+
react_1.default.createElement("h3", { className: "text-lg font-semibold border-b pb-2" }, t("servicesSectionTitle")),
|
|
27
|
+
react_1.default.createElement("div", { className: "flex flex-col gap-4" }, servicesList.map(function (row, index) { return (react_1.default.createElement("div", { key: index, className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-[1fr_1fr_0.75fr_0.75fr_0.75fr_auto] gap-4 items-end p-4 border rounded-lg" },
|
|
28
|
+
react_1.default.createElement("div", { className: "space-y-2" },
|
|
29
|
+
react_1.default.createElement(input_1.Input, { error: errors["servicesList-".concat(index, "-name")], id: "service-name-".concat(index), label: t("formLabelServiceName"), onChange: function (e) {
|
|
30
|
+
return handleItemChangeServices({
|
|
31
|
+
index: index,
|
|
32
|
+
key: "name",
|
|
33
|
+
value: e.target.value,
|
|
34
|
+
});
|
|
35
|
+
}, placeholder: t("formPlaceholderServiceName"), required: true, type: "text", value: servicesList[index].name || "" })),
|
|
36
|
+
react_1.default.createElement("div", { className: "space-y-2" },
|
|
37
|
+
react_1.default.createElement(input_1.Input, { error: errors["servicesList-".concat(index, "-description")], id: "service-description-".concat(index), label: t("formLabelServiceDescription"), onChange: function (e) {
|
|
38
|
+
return handleItemChangeServices({
|
|
39
|
+
index: index,
|
|
40
|
+
key: "description",
|
|
41
|
+
value: e.target.value,
|
|
42
|
+
});
|
|
43
|
+
}, placeholder: t("formPlaceholderServiceDescription"), type: "text", value: servicesList[index].description || "" })),
|
|
44
|
+
react_1.default.createElement("div", { className: "space-y-2" },
|
|
45
|
+
react_1.default.createElement(input_1.Input, { error: errors["servicesList-".concat(index, "-quantity")], id: "service-quantity-".concat(index), label: t("formLabelQuantity"), onChange: function (e) {
|
|
46
|
+
return handleItemChangeServices({
|
|
47
|
+
index: index,
|
|
48
|
+
key: "quantity",
|
|
49
|
+
value: e.target.value,
|
|
50
|
+
});
|
|
51
|
+
}, placeholder: "1", required: true, type: "number", value: servicesList[index].quantity || "" })),
|
|
52
|
+
react_1.default.createElement("div", { className: "space-y-2" },
|
|
53
|
+
react_1.default.createElement(input_1.Input, { error: errors["servicesList-".concat(index, "-price")], id: "service-price-".concat(index), label: t("formLabelPrice"), onChange: function (e) {
|
|
54
|
+
return handleItemChangeServices({
|
|
55
|
+
index: index,
|
|
56
|
+
key: "price",
|
|
57
|
+
value: e.target.value,
|
|
58
|
+
});
|
|
59
|
+
}, placeholder: "0.00", required: true, type: "number", value: servicesList[index].price || "" })),
|
|
60
|
+
react_1.default.createElement("div", { className: "space-y-2" },
|
|
61
|
+
react_1.default.createElement(input_1.Input, { error: errors["servicesList-".concat(index, "-rowTotal")], id: "service-rowTotal-".concat(index), label: t("formLabelRowTotal"), onChange: function (e) {
|
|
62
|
+
return handleItemChangeServices({
|
|
63
|
+
index: index,
|
|
64
|
+
key: "rowTotal",
|
|
65
|
+
value: e.target.value,
|
|
66
|
+
});
|
|
67
|
+
}, placeholder: "0.00", readOnly: true, required: true, type: "number", value: servicesList[index].rowTotal || "" })),
|
|
68
|
+
react_1.default.createElement("div", { className: "flex items-end h-full" },
|
|
69
|
+
react_1.default.createElement(button_1.Button, { onClick: function () { return handleDeleteServiceRow(index); }, size: "icon", type: "button", variant: "ghost" },
|
|
70
|
+
react_1.default.createElement(lucide_react_1.Trash2, { className: "h-4 w-4" }),
|
|
71
|
+
react_1.default.createElement("span", { className: "sr-only" }, t("buttonDeleteService")))))); }))));
|
|
72
|
+
};
|
|
73
|
+
exports.ServicesSection = ServicesSection;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { CompanyTypeBE } from "@appcorp/stellar-solutions-company-module/base-modules/company/types";
|
|
2
|
+
import { Dispatch } from "react";
|
|
3
|
+
import { QuoteActions } from "./actions";
|
|
4
|
+
import { ProductTypeBE } from "@appcorp/stellar-solutions-product-module/base-modules/product/types";
|
|
5
|
+
import { PaymentTypeBE, TaxTypeBE } from "@appcorp/stellar-solutions-modules/global-modules/preferences/types";
|
|
6
|
+
import { HeaderAction, RowAction } from "@appcorp/shadcn/components/enhanced-table";
|
|
7
|
+
import { Product, QuoteInvoiceTypeBE, Service } from "../invoice/types";
|
|
8
|
+
import { ContactTypeBE } from "@appcorp/stellar-solutions-company-module/base-modules/contact/types";
|
|
9
|
+
import { CustomerTypeBE } from "@appcorp/stellar-solutions-company-module/base-modules/customer/types";
|
|
10
|
+
export interface QuoteContextType {
|
|
11
|
+
byIdError?: Error;
|
|
12
|
+
byIdLoading: boolean;
|
|
13
|
+
clearSearch: () => void;
|
|
14
|
+
closeDrawer: () => void;
|
|
15
|
+
deleteError?: Error;
|
|
16
|
+
deleteLoading: boolean;
|
|
17
|
+
dispatch: Dispatch<QuoteActions>;
|
|
18
|
+
handleAddItemProduct: () => void;
|
|
19
|
+
handleAddItemService: () => void;
|
|
20
|
+
handleChange: (field: string, value: string) => void;
|
|
21
|
+
handleDeleteProductRow: (i: number) => void;
|
|
22
|
+
handleDeleteServiceRow: (i: number) => void;
|
|
23
|
+
handleItemChangeProducts: ({ index, key, value, }: {
|
|
24
|
+
index: number;
|
|
25
|
+
key: keyof Product;
|
|
26
|
+
value: string | number;
|
|
27
|
+
}) => void;
|
|
28
|
+
handleItemChangeServices: ({ index, key, value, }: {
|
|
29
|
+
index: number;
|
|
30
|
+
key: keyof Service;
|
|
31
|
+
value: string | number;
|
|
32
|
+
}) => void;
|
|
33
|
+
handleNextClick: () => void;
|
|
34
|
+
handlePageLimit: (node: string, value: object) => void;
|
|
35
|
+
handlePreviousClick: () => void;
|
|
36
|
+
handleSubmit: () => void;
|
|
37
|
+
headerActions: HeaderAction[];
|
|
38
|
+
listError?: Error;
|
|
39
|
+
listFetchNow: () => void;
|
|
40
|
+
listLoading: boolean;
|
|
41
|
+
rowActions: RowAction[];
|
|
42
|
+
searchOnChange: (k: string, v: string) => void;
|
|
43
|
+
updateError?: Error;
|
|
44
|
+
updateLoading: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface QuoteState extends Omit<QuoteInvoiceTypeBE, "createdAt" | "updatedAt"> {
|
|
47
|
+
afterDiscount: string;
|
|
48
|
+
companiesList: CompanyTypeBE[];
|
|
49
|
+
companyQuery: string;
|
|
50
|
+
contactsList: ContactTypeBE[];
|
|
51
|
+
count: number;
|
|
52
|
+
countryQuery: string;
|
|
53
|
+
currentPage: number;
|
|
54
|
+
customerId?: string;
|
|
55
|
+
disableSaveButton: boolean;
|
|
56
|
+
drawer: null | QUOTE_DRAWER;
|
|
57
|
+
errors: {
|
|
58
|
+
[key: string]: string;
|
|
59
|
+
};
|
|
60
|
+
getProducts: ProductTypeBE[];
|
|
61
|
+
quotes: QuoteInvoiceTypeBE[];
|
|
62
|
+
loading: boolean;
|
|
63
|
+
modal: null | QUOTE_MODAL;
|
|
64
|
+
mode: "Create" | "Edit";
|
|
65
|
+
netTotal: string;
|
|
66
|
+
pageLimit: number;
|
|
67
|
+
productQuery: string;
|
|
68
|
+
productsList: Product[];
|
|
69
|
+
searchQuery: string;
|
|
70
|
+
servicesList: Service[];
|
|
71
|
+
tax: string;
|
|
72
|
+
taxQuery: string;
|
|
73
|
+
taxes: TaxTypeBE[];
|
|
74
|
+
}
|
|
75
|
+
export interface QuoteInvoiceTypeFE {
|
|
76
|
+
category: QUOTE_INVOICE_CATEGORY;
|
|
77
|
+
company?: CompanyTypeBE;
|
|
78
|
+
companyId?: string;
|
|
79
|
+
createdAt: string;
|
|
80
|
+
currency: string;
|
|
81
|
+
customer?: CustomerTypeBE;
|
|
82
|
+
customerId?: string;
|
|
83
|
+
date: string;
|
|
84
|
+
discount?: string;
|
|
85
|
+
discountUnit: DISCOUNT_UNIT;
|
|
86
|
+
expiryDate: string;
|
|
87
|
+
id: string;
|
|
88
|
+
invoiceStatus: INVOICE_STATUS;
|
|
89
|
+
note: string;
|
|
90
|
+
payments: PaymentTypeBE[];
|
|
91
|
+
productsList: Product[];
|
|
92
|
+
quoteStatus: QUOTE_STATUS;
|
|
93
|
+
ref: string;
|
|
94
|
+
servicesList: Service[];
|
|
95
|
+
subTotal: string;
|
|
96
|
+
taxRate: string;
|
|
97
|
+
total: string;
|
|
98
|
+
updatedAt: string;
|
|
99
|
+
}
|
|
100
|
+
export declare enum QUOTE_DRAWER {
|
|
101
|
+
QUOTE_COMPANY_FORM_DRAWER = "QUOTE_COMPANY_FORM_DRAWER",
|
|
102
|
+
QUOTE_CUSTOMER_FORM_DRAWER = "QUOTE_CUSTOMER_FORM_DRAWER"
|
|
103
|
+
}
|
|
104
|
+
export declare enum QUOTE_MODAL {
|
|
105
|
+
DUMMY = "DUMMY"
|
|
106
|
+
}
|
|
107
|
+
export declare enum QUOTE_INVOICE_CATEGORY {
|
|
108
|
+
QUOTE = "QUOTE",
|
|
109
|
+
INVOICE = "INVOICE"
|
|
110
|
+
}
|
|
111
|
+
export declare enum INVOICE_STATUS {
|
|
112
|
+
UNPAID = "UNPAID",
|
|
113
|
+
PAID = "PAID"
|
|
114
|
+
}
|
|
115
|
+
export declare enum QUOTE_STATUS {
|
|
116
|
+
DRAFT = "DRAFT",
|
|
117
|
+
PENDING = "PENDING",
|
|
118
|
+
SENT = "SENT",
|
|
119
|
+
ACCEPTED = "ACCEPTED",
|
|
120
|
+
DECLINED = "DECLINED"
|
|
121
|
+
}
|
|
122
|
+
export declare enum DISCOUNT_UNIT {
|
|
123
|
+
FIXED_VALUE = "FIXED_VALUE",
|
|
124
|
+
PERCENTAGE_VALUE = "PERCENTAGE_VALUE"
|
|
125
|
+
}
|
|
126
|
+
export type { Product, Service, QuoteInvoiceTypeBE };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DISCOUNT_UNIT = exports.QUOTE_STATUS = exports.INVOICE_STATUS = exports.QUOTE_INVOICE_CATEGORY = exports.QUOTE_MODAL = exports.QUOTE_DRAWER = void 0;
|
|
4
|
+
var QUOTE_DRAWER;
|
|
5
|
+
(function (QUOTE_DRAWER) {
|
|
6
|
+
QUOTE_DRAWER["QUOTE_COMPANY_FORM_DRAWER"] = "QUOTE_COMPANY_FORM_DRAWER";
|
|
7
|
+
QUOTE_DRAWER["QUOTE_CUSTOMER_FORM_DRAWER"] = "QUOTE_CUSTOMER_FORM_DRAWER";
|
|
8
|
+
})(QUOTE_DRAWER || (exports.QUOTE_DRAWER = QUOTE_DRAWER = {}));
|
|
9
|
+
var QUOTE_MODAL;
|
|
10
|
+
(function (QUOTE_MODAL) {
|
|
11
|
+
QUOTE_MODAL["DUMMY"] = "DUMMY";
|
|
12
|
+
})(QUOTE_MODAL || (exports.QUOTE_MODAL = QUOTE_MODAL = {}));
|
|
13
|
+
var QUOTE_INVOICE_CATEGORY;
|
|
14
|
+
(function (QUOTE_INVOICE_CATEGORY) {
|
|
15
|
+
QUOTE_INVOICE_CATEGORY["QUOTE"] = "QUOTE";
|
|
16
|
+
QUOTE_INVOICE_CATEGORY["INVOICE"] = "INVOICE";
|
|
17
|
+
})(QUOTE_INVOICE_CATEGORY || (exports.QUOTE_INVOICE_CATEGORY = QUOTE_INVOICE_CATEGORY = {}));
|
|
18
|
+
var INVOICE_STATUS;
|
|
19
|
+
(function (INVOICE_STATUS) {
|
|
20
|
+
INVOICE_STATUS["UNPAID"] = "UNPAID";
|
|
21
|
+
INVOICE_STATUS["PAID"] = "PAID";
|
|
22
|
+
})(INVOICE_STATUS || (exports.INVOICE_STATUS = INVOICE_STATUS = {}));
|
|
23
|
+
var QUOTE_STATUS;
|
|
24
|
+
(function (QUOTE_STATUS) {
|
|
25
|
+
QUOTE_STATUS["DRAFT"] = "DRAFT";
|
|
26
|
+
QUOTE_STATUS["PENDING"] = "PENDING";
|
|
27
|
+
QUOTE_STATUS["SENT"] = "SENT";
|
|
28
|
+
QUOTE_STATUS["ACCEPTED"] = "ACCEPTED";
|
|
29
|
+
QUOTE_STATUS["DECLINED"] = "DECLINED";
|
|
30
|
+
})(QUOTE_STATUS || (exports.QUOTE_STATUS = QUOTE_STATUS = {}));
|
|
31
|
+
var DISCOUNT_UNIT;
|
|
32
|
+
(function (DISCOUNT_UNIT) {
|
|
33
|
+
DISCOUNT_UNIT["FIXED_VALUE"] = "FIXED_VALUE";
|
|
34
|
+
DISCOUNT_UNIT["PERCENTAGE_VALUE"] = "PERCENTAGE_VALUE";
|
|
35
|
+
})(DISCOUNT_UNIT || (exports.DISCOUNT_UNIT = DISCOUNT_UNIT = {}));
|