@appcorp/stellar-solutions-invoice-module 0.1.74 → 0.1.75
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 +1 -5
- package/base-modules/invoice/add-service-product-section.js +3 -3
- package/base-modules/invoice/cache.d.ts +15 -0
- package/base-modules/invoice/cache.js +50 -0
- package/base-modules/invoice/calculate-subtotal.d.ts +6 -1
- package/base-modules/invoice/calculate-subtotal.js +2 -2
- package/base-modules/invoice/calculate-total.d.ts +1 -1
- package/base-modules/invoice/calculate-total.js +8 -8
- package/base-modules/invoice/company-form-section.d.ts +1 -5
- package/base-modules/invoice/company-form-section.js +25 -22
- package/base-modules/invoice/constants.d.ts +2 -3
- package/base-modules/invoice/constants.js +2 -3
- package/base-modules/invoice/context.d.ts +556 -20
- package/base-modules/invoice/context.js +530 -342
- package/base-modules/invoice/customer-form-section.d.ts +1 -5
- package/base-modules/invoice/customer-form-section.js +25 -9
- package/base-modules/invoice/form.d.ts +1 -5
- package/base-modules/invoice/form.js +9 -9
- package/base-modules/invoice/page.d.ts +8 -0
- package/base-modules/invoice/page.js +171 -0
- package/base-modules/invoice/pricing-form-section.d.ts +1 -5
- package/base-modules/invoice/pricing-form-section.js +16 -11
- package/base-modules/invoice/products-form-section.d.ts +1 -5
- package/base-modules/invoice/products-form-section.js +49 -40
- package/base-modules/invoice/services-form-section.d.ts +1 -5
- package/base-modules/invoice/services-form-section.js +10 -9
- package/base-modules/invoice/validate.d.ts +83 -25
- package/base-modules/invoice/validate.js +4 -4
- package/base-modules/payment/cache.d.ts +15 -0
- package/base-modules/payment/cache.js +52 -0
- package/base-modules/payment/constants.d.ts +1 -14
- package/base-modules/payment/constants.js +2 -15
- package/base-modules/payment/context.d.ts +214 -48
- package/base-modules/payment/context.js +266 -237
- package/base-modules/payment/drawer.d.ts +0 -6
- package/base-modules/payment/drawer.js +89 -44
- package/base-modules/payment/form.js +3 -2
- package/base-modules/payment/{payment.js → page.js} +2 -5
- package/base-modules/payment/types.d.ts +0 -85
- package/base-modules/payment/types.js +74 -21
- package/base-modules/payment/validate.d.ts +12 -0
- package/base-modules/payment/validate.js +19 -8
- package/base-modules/payment/view.d.ts +1 -5
- package/base-modules/payment/view.js +4 -3
- package/base-modules/quote/add-service-product-section.js +1 -1
- package/base-modules/quote/cache.d.ts +15 -0
- package/base-modules/quote/cache.js +50 -0
- package/base-modules/quote/company-form-section.d.ts +1 -1
- package/base-modules/quote/company-form-section.js +14 -12
- package/base-modules/quote/constants.js +1 -0
- package/base-modules/quote/context.d.ts +656 -46
- package/base-modules/quote/context.js +413 -289
- package/base-modules/quote/customer-form-section.d.ts +1 -1
- package/base-modules/quote/customer-form-section.js +24 -9
- package/base-modules/quote/form.d.ts +1 -5
- package/base-modules/quote/form.js +8 -9
- package/base-modules/quote/page.d.ts +8 -0
- package/base-modules/quote/page.js +163 -0
- package/base-modules/quote/pricing-form-section.js +9 -8
- package/base-modules/quote/products-form-section.js +2 -2
- package/base-modules/quote/services-form-section.js +1 -1
- package/base-modules/quote/types.d.ts +0 -127
- package/base-modules/quote/types.js +92 -35
- package/base-modules/quote/validate.d.ts +82 -25
- package/base-modules/quote/validate.js +3 -4
- package/package.json +8 -8
- package/base-modules/invoice/actions.d.ts +0 -215
- package/base-modules/invoice/actions.js +0 -38
- package/base-modules/invoice/drawer.d.ts +0 -13
- package/base-modules/invoice/drawer.js +0 -46
- package/base-modules/invoice/invoice.d.ts +0 -8
- package/base-modules/invoice/invoice.js +0 -69
- package/base-modules/invoice/reducer.d.ts +0 -4
- package/base-modules/invoice/reducer.js +0 -180
- package/base-modules/invoice/types.d.ts +0 -211
- package/base-modules/invoice/types.js +0 -43
- package/base-modules/payment/actions.d.ts +0 -203
- package/base-modules/payment/actions.js +0 -50
- package/base-modules/payment/reducer.d.ts +0 -29
- package/base-modules/payment/reducer.js +0 -215
- package/base-modules/quote/actions.d.ts +0 -215
- package/base-modules/quote/actions.js +0 -38
- package/base-modules/quote/drawer.d.ts +0 -13
- package/base-modules/quote/drawer.js +0 -46
- package/base-modules/quote/quote.d.ts +0 -8
- package/base-modules/quote/quote.js +0 -69
- package/base-modules/quote/reducer.d.ts +0 -4
- package/base-modules/quote/reducer.js +0 -181
- /package/base-modules/payment/{payment.d.ts → page.d.ts} +0 -0
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.InvoicePage = void 0;
|
|
8
|
-
var react_1 = __importDefault(require("react"));
|
|
9
|
-
var next_intl_1 = require("next-intl");
|
|
10
|
-
var util_functions_1 = require("@react-pakistan/util-functions");
|
|
11
|
-
var use_rtl_1 = require("@appcorp/stellar-solutions-modules/hooks/use-rtl");
|
|
12
|
-
var enhanced_table_1 = require("@appcorp/shadcn/components/enhanced-table");
|
|
13
|
-
var sonner_1 = require("@appcorp/shadcn/components/ui/sonner");
|
|
14
|
-
var constants_1 = require("./constants");
|
|
15
|
-
var context_1 = require("./context");
|
|
16
|
-
var drawer_1 = require("./drawer");
|
|
17
|
-
var InvoicePage = function () {
|
|
18
|
-
var _a = (0, context_1.useInvoiceStateContext)(), count = _a.count, currentPage = _a.currentPage, handleNextClick = _a.handleNextClick, handlePageLimit = _a.handlePageLimit, handlePreviousClick = _a.handlePreviousClick, headerActions = _a.headerActions, invoices = _a.invoices, listLoading = _a.listLoading, pageLimit = _a.pageLimit, rowActions = _a.rowActions, searchOnChange = _a.searchOnChange, searchQuery = _a.searchQuery;
|
|
19
|
-
var isRTL = (0, use_rtl_1.useRTL)();
|
|
20
|
-
var t = (0, next_intl_1.useTranslations)("invoice");
|
|
21
|
-
var tableHeadItems = [
|
|
22
|
-
{
|
|
23
|
-
label: t("tableColumnHeaderId"),
|
|
24
|
-
width: "5%",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
label: t("tableColumnHeaderName"),
|
|
28
|
-
width: "10%",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
label: t("tableColumnHeaderIssueExpiryDate"),
|
|
32
|
-
width: "10%",
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
label: t("tableColumnHeaderRef"),
|
|
36
|
-
width: "5%",
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
label: t("tableColumnHeaderSubTotal"),
|
|
40
|
-
width: "5%",
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: t("tableColumnHeaderTaxValue"),
|
|
44
|
-
width: "5%",
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
label: t("tableColumnHeaderDiscountPrice"),
|
|
48
|
-
width: "5%",
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
label: t("tableColumnHeaderTotalPrice"),
|
|
52
|
-
width: "5%",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
label: t("tableColumnHeaderCategory"),
|
|
56
|
-
width: "5%",
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
label: t("tableColumnHeaderActions"),
|
|
60
|
-
width: "5%",
|
|
61
|
-
},
|
|
62
|
-
];
|
|
63
|
-
var totalPages = (0, util_functions_1.calculatePages)(count, pageLimit);
|
|
64
|
-
return (react_1.default.createElement("div", { className: "space-y-4 ".concat(isRTL ? "rtl" : "ltr"), dir: isRTL ? "rtl" : "ltr" },
|
|
65
|
-
react_1.default.createElement(enhanced_table_1.EnhancedTable, { currentPage: Number(currentPage), handleNextOnClick: handleNextClick, handleOnSelect: handlePageLimit, handlePreviousOnClick: handlePreviousClick, handleSearchInput: searchOnChange, headerActions: headerActions, isNextDisabled: (0, util_functions_1.isNextButtonDisabled)(currentPage, totalPages), isPreviousDisabled: (0, util_functions_1.isPreviousButtonDisabled)(currentPage), listOptions: (0, util_functions_1.getAvailablePageLimits)(count), loading: listLoading, nodeSelectKey: "pageLimit", pageLimit: pageLimit, rowActions: rowActions, searchDisabled: false, searchEnabled: true, searchId: "invoice-search", searchPlaceholder: t("tableSearchPlaceholder"), searchValue: searchQuery, tableBodyCols: constants_1.tableBodyCols, tableBodyRows: invoices, tableDescription: t("tableDescription"), tableHeadItems: tableHeadItems, tableHeading: t("tableTitle"), totalPages: totalPages }),
|
|
66
|
-
react_1.default.createElement(drawer_1.Drawer, { isRTL: isRTL }),
|
|
67
|
-
react_1.default.createElement(sonner_1.Toaster, null)));
|
|
68
|
-
};
|
|
69
|
-
exports.InvoicePage = InvoicePage;
|
|
@@ -1,180 +0,0 @@
|
|
|
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.initialInvoiceState = void 0;
|
|
24
|
-
exports.invoiceReducer = invoiceReducer;
|
|
25
|
-
var actions_1 = require("./actions");
|
|
26
|
-
var types_1 = require("./types");
|
|
27
|
-
var constants_1 = require("./constants");
|
|
28
|
-
var date_fns_1 = require("date-fns");
|
|
29
|
-
exports.initialInvoiceState = {
|
|
30
|
-
afterDiscount: "0",
|
|
31
|
-
category: types_1.QUOTE_INVOICE_CATEGORY.INVOICE,
|
|
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_1.INVOICE_STATUS.UNPAID,
|
|
63
|
-
invoices: [],
|
|
64
|
-
loading: true,
|
|
65
|
-
getProducts: [],
|
|
66
|
-
modal: null,
|
|
67
|
-
mode: "Create",
|
|
68
|
-
netTotal: "",
|
|
69
|
-
note: "",
|
|
70
|
-
pageLimit: constants_1.pageLimit,
|
|
71
|
-
payments: [],
|
|
72
|
-
companiesList: [],
|
|
73
|
-
productQuery: "",
|
|
74
|
-
quoteStatus: types_1.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
|
-
function invoiceReducer(state, action) {
|
|
117
|
-
var _a, _b;
|
|
118
|
-
switch (action.type) {
|
|
119
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_DRAWER:
|
|
120
|
-
return __assign(__assign({}, state), { drawer: action.payload.drawer });
|
|
121
|
-
case actions_1.INVOICE_ACTION_TYPES.RESET_ERRORS:
|
|
122
|
-
return __assign(__assign({}, state), { errors: {} });
|
|
123
|
-
case actions_1.INVOICE_ACTION_TYPES.RESET_FORM:
|
|
124
|
-
return __assign(__assign(__assign(__assign({}, state), (state.customer && {
|
|
125
|
-
customer: __assign({}, exports.initialInvoiceState.customer),
|
|
126
|
-
})), (state.company && {
|
|
127
|
-
company: __assign({}, exports.initialInvoiceState.company),
|
|
128
|
-
})), { productsList: __spreadArray([], exports.initialInvoiceState.productsList, true), servicesList: __spreadArray([], exports.initialInvoiceState.servicesList, true), subTotal: exports.initialInvoiceState.subTotal, discount: exports.initialInvoiceState.discount, discountUnit: exports.initialInvoiceState.discountUnit, afterDiscount: exports.initialInvoiceState.afterDiscount, tax: exports.initialInvoiceState.tax, total: exports.initialInvoiceState.total, category: exports.initialInvoiceState.category, companyId: exports.initialInvoiceState.companyId, companyQuery: exports.initialInvoiceState.companyQuery, countryQuery: exports.initialInvoiceState.companyQuery, currency: exports.initialInvoiceState.currency, contactsList: exports.initialInvoiceState.contactsList, customerId: exports.initialInvoiceState.customerId, date: exports.initialInvoiceState.date, disableSaveButton: exports.initialInvoiceState.disableSaveButton, expiryDate: exports.initialInvoiceState.expiryDate, id: exports.initialInvoiceState.id, invoiceStatus: exports.initialInvoiceState.invoiceStatus, loading: exports.initialInvoiceState.loading, getProducts: exports.initialInvoiceState.getProducts, mode: exports.initialInvoiceState.mode, netTotal: exports.initialInvoiceState.netTotal, note: exports.initialInvoiceState.note, payments: exports.initialInvoiceState.payments, companiesList: exports.initialInvoiceState.companiesList, productQuery: exports.initialInvoiceState.productQuery, taxRate: exports.initialInvoiceState.taxRate, taxQuery: exports.initialInvoiceState.taxQuery, taxes: exports.initialInvoiceState.taxes });
|
|
129
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON:
|
|
130
|
-
return __assign(__assign({}, state), { disableSaveButton: action.payload.disableSaveButton });
|
|
131
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_CURRENT_PAGE:
|
|
132
|
-
return __assign(__assign({}, state), { currentPage: action.payload.currentPage });
|
|
133
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_COUNT:
|
|
134
|
-
return __assign(__assign({}, state), { count: action.payload.count });
|
|
135
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_ERRORS:
|
|
136
|
-
return __assign(__assign({}, state), { disableSaveButton: false, errors: __assign({}, action.payload.errors) });
|
|
137
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_INPUT_FIELD:
|
|
138
|
-
return __assign(__assign({}, state), (_a = {}, _a[action.payload.key] = action.payload.value, _a));
|
|
139
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_PAGE_LIMIT:
|
|
140
|
-
return __assign(__assign({}, state), { pageLimit: action.payload.pageLimit });
|
|
141
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_INVOICES:
|
|
142
|
-
return __assign(__assign({}, state), { invoices: __spreadArray([], action.payload.invoices, true) });
|
|
143
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_SEARCH_QUERY:
|
|
144
|
-
return __assign(__assign({}, state), { searchQuery: action.payload.searchQuery });
|
|
145
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_FORM:
|
|
146
|
-
return __assign(__assign({}, state), action.payload.form);
|
|
147
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_DRAWER:
|
|
148
|
-
return __assign(__assign({}, state), { drawer: action.payload.drawer });
|
|
149
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_MODAL:
|
|
150
|
-
return __assign(__assign({}, state), { modal: action.payload.modal });
|
|
151
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_DISCOUNT_UNIT:
|
|
152
|
-
return __assign(__assign({}, state), { discountUnit: action.payload.discountUnit });
|
|
153
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_AFTER_DISCOUNT:
|
|
154
|
-
return __assign(__assign({}, state), { afterDiscount: action.payload.afterDiscount });
|
|
155
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_TAX:
|
|
156
|
-
return __assign(__assign({}, state), { tax: action.payload.tax });
|
|
157
|
-
case actions_1.INVOICE_ACTION_TYPES.ADD_ITEM_SERVICE:
|
|
158
|
-
return __assign(__assign({}, state), { servicesList: __spreadArray([], action.payload.servicesList, true) });
|
|
159
|
-
case actions_1.INVOICE_ACTION_TYPES.ADD_ITEM_PRODUCT:
|
|
160
|
-
return __assign(__assign({}, state), { productsList: __spreadArray([], action.payload.productsList, true) });
|
|
161
|
-
case actions_1.INVOICE_ACTION_TYPES.DELETE_ITEM_SERVICE:
|
|
162
|
-
return __assign(__assign({}, state), { servicesList: __spreadArray([], action.payload.servicesList, true) });
|
|
163
|
-
case actions_1.INVOICE_ACTION_TYPES.DELETE_ITEM_PRODUCT:
|
|
164
|
-
return __assign(__assign({}, state), { productsList: __spreadArray([], action.payload.productsList, true) });
|
|
165
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_PRODUCTS_LIST:
|
|
166
|
-
return __assign(__assign({}, state), { getProducts: __spreadArray([], action.payload.list, true) });
|
|
167
|
-
case actions_1.INVOICE_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.INVOICE_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.INVOICE_ACTION_TYPES.SET_TAXES:
|
|
174
|
-
return __assign(__assign({}, state), { taxes: __spreadArray([], action.payload.taxes, true) });
|
|
175
|
-
case actions_1.INVOICE_ACTION_TYPES.SET_COMPANIES_LIST:
|
|
176
|
-
return __assign(__assign({}, state), { companiesList: __spreadArray([], action.payload.companiesList, true) });
|
|
177
|
-
default:
|
|
178
|
-
return state;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { CompanyTypeBE } from "@appcorp/stellar-solutions-company-module/base-modules/company/types";
|
|
2
|
-
import { Dispatch } from "react";
|
|
3
|
-
import { InvoiceActions } from "./actions";
|
|
4
|
-
import { ProductTypeBE } from "@appcorp/stellar-solutions-product-module/base-modules/product/types";
|
|
5
|
-
import { ContactTypeBE } from "@appcorp/stellar-solutions-company-module/base-modules/contact/types";
|
|
6
|
-
import { TaxTypeBE } from "@appcorp/stellar-solutions-modules/global-modules/preferences/types";
|
|
7
|
-
import { CustomerTypeBE } from "@appcorp/stellar-solutions-company-module/base-modules/customer/types";
|
|
8
|
-
import { HeaderAction, RowAction } from "@appcorp/shadcn/components/enhanced-table";
|
|
9
|
-
export interface InvoiceContextType {
|
|
10
|
-
byIdError?: Error;
|
|
11
|
-
byIdLoading: boolean;
|
|
12
|
-
clearSearch: () => void;
|
|
13
|
-
closeDrawer: () => void;
|
|
14
|
-
deleteError?: Error;
|
|
15
|
-
deleteLoading: boolean;
|
|
16
|
-
dispatch: Dispatch<InvoiceActions>;
|
|
17
|
-
handleAddItemProduct: () => void;
|
|
18
|
-
handleAddItemService: () => void;
|
|
19
|
-
handleChange: (field: string, value: string) => void;
|
|
20
|
-
handleDeleteProductRow: (i: number) => void;
|
|
21
|
-
handleDeleteServiceRow: (i: number) => void;
|
|
22
|
-
handleItemChangeProducts: ({ index, key, value, }: {
|
|
23
|
-
index: number;
|
|
24
|
-
key: keyof Product;
|
|
25
|
-
value: string | number;
|
|
26
|
-
}) => void;
|
|
27
|
-
handleItemChangeServices: ({ index, key, value, }: {
|
|
28
|
-
index: number;
|
|
29
|
-
key: keyof Service;
|
|
30
|
-
value: string | number;
|
|
31
|
-
}) => void;
|
|
32
|
-
handleNextClick: () => void;
|
|
33
|
-
handlePageLimit: (node: string, value: object) => void;
|
|
34
|
-
handlePreviousClick: () => void;
|
|
35
|
-
handleSubmit: () => void;
|
|
36
|
-
handleTaxSearch: (searchQuery: string) => 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 Product {
|
|
47
|
-
id: string;
|
|
48
|
-
mode: "Create" | "Edit" | "";
|
|
49
|
-
price: string;
|
|
50
|
-
quantity: string;
|
|
51
|
-
rowTotal: string;
|
|
52
|
-
}
|
|
53
|
-
export interface Service {
|
|
54
|
-
id?: string;
|
|
55
|
-
name: string;
|
|
56
|
-
description: string;
|
|
57
|
-
quantity: string;
|
|
58
|
-
price: string;
|
|
59
|
-
mode: "Create" | "Edit" | "";
|
|
60
|
-
rowTotal: string;
|
|
61
|
-
}
|
|
62
|
-
export declare enum PAYMENT_MODE {
|
|
63
|
-
}
|
|
64
|
-
export declare enum PAYMENT_TYPE {
|
|
65
|
-
FULL_AMOUNT = "FULL_AMOUNT",
|
|
66
|
-
PARTIAL_AMOUNT = "PARTIAL_AMOUNT"
|
|
67
|
-
}
|
|
68
|
-
export interface PaymentTypeBE {
|
|
69
|
-
amount: string;
|
|
70
|
-
attachment?: string;
|
|
71
|
-
balance: string;
|
|
72
|
-
createdAt: string;
|
|
73
|
-
currency: string;
|
|
74
|
-
date: string;
|
|
75
|
-
description?: string;
|
|
76
|
-
id: string;
|
|
77
|
-
mode: PAYMENT_MODE;
|
|
78
|
-
paymentType: PAYMENT_TYPE;
|
|
79
|
-
quoteInvoice: QuoteInvoiceTypeBE;
|
|
80
|
-
quoteInvoiceId: string;
|
|
81
|
-
ref?: string;
|
|
82
|
-
updatedAt: string;
|
|
83
|
-
}
|
|
84
|
-
export interface ServiceTypeBE {
|
|
85
|
-
createdAt: string;
|
|
86
|
-
description?: string;
|
|
87
|
-
id: string;
|
|
88
|
-
name: string;
|
|
89
|
-
price: string;
|
|
90
|
-
quantity: string;
|
|
91
|
-
quoteInvoice?: QuoteInvoiceTypeBE;
|
|
92
|
-
quoteInvoiceId?: string;
|
|
93
|
-
updatedAt: string;
|
|
94
|
-
}
|
|
95
|
-
export interface QuoteInvoiceTypeBE {
|
|
96
|
-
category: QUOTE_INVOICE_CATEGORY;
|
|
97
|
-
company?: CompanyTypeBE;
|
|
98
|
-
companyId?: string;
|
|
99
|
-
createdAt: string;
|
|
100
|
-
currency: string;
|
|
101
|
-
customer?: CustomerTypeBE;
|
|
102
|
-
customerId?: string;
|
|
103
|
-
date: string;
|
|
104
|
-
discount?: string;
|
|
105
|
-
discountUnit: DISCOUNT_UNIT;
|
|
106
|
-
expiryDate: string;
|
|
107
|
-
id: string;
|
|
108
|
-
invoiceStatus: INVOICE_STATUS;
|
|
109
|
-
note: string;
|
|
110
|
-
payments: PaymentTypeBE[];
|
|
111
|
-
products: QuoteInvoiceProductTypeBE[];
|
|
112
|
-
quoteStatus: QUOTE_STATUS;
|
|
113
|
-
ref: string;
|
|
114
|
-
services: ServiceTypeBE[];
|
|
115
|
-
subTotal: string;
|
|
116
|
-
taxRate: string;
|
|
117
|
-
total: string;
|
|
118
|
-
updatedAt: string;
|
|
119
|
-
}
|
|
120
|
-
export interface QuoteInvoiceTypeFE {
|
|
121
|
-
category: QUOTE_INVOICE_CATEGORY;
|
|
122
|
-
company?: CompanyTypeBE;
|
|
123
|
-
companyId?: string;
|
|
124
|
-
createdAt: string;
|
|
125
|
-
currency: string;
|
|
126
|
-
customer?: CustomerTypeBE;
|
|
127
|
-
customerId?: string;
|
|
128
|
-
date: string;
|
|
129
|
-
discount?: string;
|
|
130
|
-
discountUnit: DISCOUNT_UNIT;
|
|
131
|
-
expiryDate: string;
|
|
132
|
-
id: string;
|
|
133
|
-
invoiceStatus: INVOICE_STATUS;
|
|
134
|
-
note: string;
|
|
135
|
-
payments: PaymentTypeBE[];
|
|
136
|
-
productsList: Product[];
|
|
137
|
-
quoteStatus: QUOTE_STATUS;
|
|
138
|
-
ref: string;
|
|
139
|
-
servicesList: Service[];
|
|
140
|
-
subTotal: string;
|
|
141
|
-
taxRate: string;
|
|
142
|
-
total: string;
|
|
143
|
-
updatedAt: string;
|
|
144
|
-
}
|
|
145
|
-
export interface QuoteInvoiceProductTypeBE {
|
|
146
|
-
quoteInvoiceId: string;
|
|
147
|
-
productId: string;
|
|
148
|
-
product: ProductTypeBE;
|
|
149
|
-
quoteInvoice: QuoteInvoiceTypeBE;
|
|
150
|
-
quantity: string;
|
|
151
|
-
}
|
|
152
|
-
export interface InvoiceState extends Omit<QuoteInvoiceTypeBE, "createdAt" | "updatedAt"> {
|
|
153
|
-
afterDiscount: string;
|
|
154
|
-
companiesList: CompanyTypeBE[];
|
|
155
|
-
companyQuery: string;
|
|
156
|
-
contactsList: ContactTypeBE[];
|
|
157
|
-
count: number;
|
|
158
|
-
countryQuery: string;
|
|
159
|
-
currentPage: number;
|
|
160
|
-
customerId?: string;
|
|
161
|
-
disableSaveButton: boolean;
|
|
162
|
-
drawer: null | INVOICE_DRAWER;
|
|
163
|
-
errors: {
|
|
164
|
-
[key: string]: string;
|
|
165
|
-
};
|
|
166
|
-
getProducts: ProductTypeBE[];
|
|
167
|
-
invoices: QuoteInvoiceTypeBE[];
|
|
168
|
-
loading: boolean;
|
|
169
|
-
modal: null | INVOICE_MODAL;
|
|
170
|
-
mode: "Create" | "Edit";
|
|
171
|
-
netTotal: string;
|
|
172
|
-
pageLimit: number;
|
|
173
|
-
productQuery: string;
|
|
174
|
-
productsList: Product[];
|
|
175
|
-
searchQuery: string;
|
|
176
|
-
servicesList: Service[];
|
|
177
|
-
tax: string;
|
|
178
|
-
taxQuery: string;
|
|
179
|
-
taxes: TaxTypeBE[];
|
|
180
|
-
}
|
|
181
|
-
export interface FetchInvoicesArgs {
|
|
182
|
-
currentPage: number;
|
|
183
|
-
pageLimit: number;
|
|
184
|
-
searchQuery?: string;
|
|
185
|
-
}
|
|
186
|
-
export declare enum INVOICE_DRAWER {
|
|
187
|
-
INVOICE_COMPANY_FORM_DRAWER = "INVOICE_COMPANY_FORM_DRAWER",
|
|
188
|
-
INVOICE_CUSTOMER_FORM_DRAWER = "INVOICE_CUSTOMER_FORM_DRAWER"
|
|
189
|
-
}
|
|
190
|
-
export declare enum INVOICE_MODAL {
|
|
191
|
-
DUMMY = "DUMMY"
|
|
192
|
-
}
|
|
193
|
-
export declare enum QUOTE_INVOICE_CATEGORY {
|
|
194
|
-
QUOTE = "QUOTE",
|
|
195
|
-
INVOICE = "INVOICE"
|
|
196
|
-
}
|
|
197
|
-
export declare enum INVOICE_STATUS {
|
|
198
|
-
UNPAID = "UNPAID",
|
|
199
|
-
PAID = "PAID"
|
|
200
|
-
}
|
|
201
|
-
export declare enum QUOTE_STATUS {
|
|
202
|
-
DRAFT = "DRAFT",
|
|
203
|
-
PENDING = "PENDING",
|
|
204
|
-
SENT = "SENT",
|
|
205
|
-
ACCEPTED = "ACCEPTED",
|
|
206
|
-
DECLINED = "DECLINED"
|
|
207
|
-
}
|
|
208
|
-
export declare enum DISCOUNT_UNIT {
|
|
209
|
-
FIXED_VALUE = "FIXED_VALUE",
|
|
210
|
-
PERCENTAGE_VALUE = "PERCENTAGE_VALUE"
|
|
211
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
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.INVOICE_MODAL = exports.INVOICE_DRAWER = exports.PAYMENT_TYPE = exports.PAYMENT_MODE = void 0;
|
|
4
|
-
var PAYMENT_MODE;
|
|
5
|
-
(function (PAYMENT_MODE) {
|
|
6
|
-
})(PAYMENT_MODE || (exports.PAYMENT_MODE = PAYMENT_MODE = {}));
|
|
7
|
-
var PAYMENT_TYPE;
|
|
8
|
-
(function (PAYMENT_TYPE) {
|
|
9
|
-
PAYMENT_TYPE["FULL_AMOUNT"] = "FULL_AMOUNT";
|
|
10
|
-
PAYMENT_TYPE["PARTIAL_AMOUNT"] = "PARTIAL_AMOUNT";
|
|
11
|
-
})(PAYMENT_TYPE || (exports.PAYMENT_TYPE = PAYMENT_TYPE = {}));
|
|
12
|
-
var INVOICE_DRAWER;
|
|
13
|
-
(function (INVOICE_DRAWER) {
|
|
14
|
-
INVOICE_DRAWER["INVOICE_COMPANY_FORM_DRAWER"] = "INVOICE_COMPANY_FORM_DRAWER";
|
|
15
|
-
INVOICE_DRAWER["INVOICE_CUSTOMER_FORM_DRAWER"] = "INVOICE_CUSTOMER_FORM_DRAWER";
|
|
16
|
-
})(INVOICE_DRAWER || (exports.INVOICE_DRAWER = INVOICE_DRAWER = {}));
|
|
17
|
-
var INVOICE_MODAL;
|
|
18
|
-
(function (INVOICE_MODAL) {
|
|
19
|
-
INVOICE_MODAL["DUMMY"] = "DUMMY";
|
|
20
|
-
})(INVOICE_MODAL || (exports.INVOICE_MODAL = INVOICE_MODAL = {}));
|
|
21
|
-
var QUOTE_INVOICE_CATEGORY;
|
|
22
|
-
(function (QUOTE_INVOICE_CATEGORY) {
|
|
23
|
-
QUOTE_INVOICE_CATEGORY["QUOTE"] = "QUOTE";
|
|
24
|
-
QUOTE_INVOICE_CATEGORY["INVOICE"] = "INVOICE";
|
|
25
|
-
})(QUOTE_INVOICE_CATEGORY || (exports.QUOTE_INVOICE_CATEGORY = QUOTE_INVOICE_CATEGORY = {}));
|
|
26
|
-
var INVOICE_STATUS;
|
|
27
|
-
(function (INVOICE_STATUS) {
|
|
28
|
-
INVOICE_STATUS["UNPAID"] = "UNPAID";
|
|
29
|
-
INVOICE_STATUS["PAID"] = "PAID";
|
|
30
|
-
})(INVOICE_STATUS || (exports.INVOICE_STATUS = INVOICE_STATUS = {}));
|
|
31
|
-
var QUOTE_STATUS;
|
|
32
|
-
(function (QUOTE_STATUS) {
|
|
33
|
-
QUOTE_STATUS["DRAFT"] = "DRAFT";
|
|
34
|
-
QUOTE_STATUS["PENDING"] = "PENDING";
|
|
35
|
-
QUOTE_STATUS["SENT"] = "SENT";
|
|
36
|
-
QUOTE_STATUS["ACCEPTED"] = "ACCEPTED";
|
|
37
|
-
QUOTE_STATUS["DECLINED"] = "DECLINED";
|
|
38
|
-
})(QUOTE_STATUS || (exports.QUOTE_STATUS = QUOTE_STATUS = {}));
|
|
39
|
-
var DISCOUNT_UNIT;
|
|
40
|
-
(function (DISCOUNT_UNIT) {
|
|
41
|
-
DISCOUNT_UNIT["FIXED_VALUE"] = "FIXED_VALUE";
|
|
42
|
-
DISCOUNT_UNIT["PERCENTAGE_VALUE"] = "PERCENTAGE_VALUE";
|
|
43
|
-
})(DISCOUNT_UNIT || (exports.DISCOUNT_UNIT = DISCOUNT_UNIT = {}));
|