@appcorp/stellar-solutions-invoice-module 0.1.56 → 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 +9 -25
- package/base-modules/invoice/constants.js +66 -557
- package/base-modules/invoice/context.d.ts +42 -2
- package/base-modules/invoice/context.js +220 -311
- 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 -32
- package/base-modules/invoice/reducer.d.ts +2 -2
- package/base-modules/invoice/reducer.js +56 -53
- package/base-modules/invoice/services-form-section.d.ts +12 -2
- package/base-modules/invoice/services-form-section.js +61 -15
- package/base-modules/invoice/types.d.ts +16 -21
- package/base-modules/invoice/validate.d.ts +23 -3
- package/base-modules/invoice/validate.js +61 -61
- 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 +21 -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,215 @@
|
|
|
1
|
+
import { ProductTypeBE } from "@appcorp/stellar-solutions-product-module/base-modules/product/types";
|
|
2
|
+
import { DISCOUNT_UNIT, QUOTE_DRAWER, QuoteState, QuoteInvoiceTypeBE, Product, Service, QUOTE_MODAL } from "./types";
|
|
3
|
+
import { TaxTypeBE } from "@appcorp/stellar-solutions-modules/global-modules/preferences/types";
|
|
4
|
+
import { CompanyTypeBE } from "@appcorp/stellar-solutions-company-module/base-modules/company/types";
|
|
5
|
+
import { CustomerTypeBE } from "@appcorp/stellar-solutions-company-module/base-modules/customer/types";
|
|
6
|
+
export declare enum QUOTE_ACTION_TYPES {
|
|
7
|
+
ADD_ITEM_PRODUCT = "ADD_ITEM_PRODUCT",
|
|
8
|
+
ADD_ITEM_SERVICE = "ADD_ITEM_SERVICE",
|
|
9
|
+
DELETE_ITEM_PRODUCT = "DELETE_ITEM_PRODUCT",
|
|
10
|
+
DELETE_ITEM_SERVICE = "DELETE_ITEM_SERVICE",
|
|
11
|
+
RESET_ERRORS = "RESET_ERRORS",
|
|
12
|
+
RESET_FORM = "RESET_FORM",
|
|
13
|
+
SET_AFTER_DISCOUNT = "SET_AFTER_DISCOUNT",
|
|
14
|
+
SET_BUTTON_DISABLE = "SET_BUTTON_DISABLE",
|
|
15
|
+
SET_COMPANIES_LIST = "SET_COMPANIES_LIST",
|
|
16
|
+
SET_COUNT = "SET_COUNT",
|
|
17
|
+
SET_CURRENT_PAGE = "SET_CURRENT_PAGE",
|
|
18
|
+
SET_CUSTOMER = "SET_CUSTOMER",
|
|
19
|
+
SET_CUSTOMER_DATA = "SET_CUSTOMER_DATA",
|
|
20
|
+
SET_CUSTOMER_FORM = "SET_CUSTOMER_FORM",
|
|
21
|
+
SET_DISABLE_SAVE_BUTTON = "SET_DISABLE_SAVE_BUTTON",
|
|
22
|
+
SET_DISCOUNT_UNIT = "SET_DISCOUNT_UNIT",
|
|
23
|
+
SET_DRAWER = "SET_DRAWER",
|
|
24
|
+
SET_ERRORS = "SET_ERRORS",
|
|
25
|
+
SET_FORM = "SET_FORM",
|
|
26
|
+
SET_FORM_LOADING = "SET_FORM_LOADING",
|
|
27
|
+
SET_FORM_TO_RENDER = "SET_FORM_TO_RENDER",
|
|
28
|
+
SET_INPUT_FIELD = "SET_INPUT_FIELD",
|
|
29
|
+
SET_QUOTES = "SET_QUOTES",
|
|
30
|
+
SET_QUOTE_FORM = "SET_QUOTE_FORM",
|
|
31
|
+
SET_IS_QUOTE_API_SUCCESS = "SET_IS_QUOTE_API_SUCCESS",
|
|
32
|
+
SET_MODAL = "SET_MODAL",
|
|
33
|
+
SET_PAGE_LIMIT = "SET_PAGE_LIMIT",
|
|
34
|
+
SET_PRODUCTS_LIST = "SET_PRODUCTS_LIST",
|
|
35
|
+
SET_SEARCH_QUERY = "SET_SEARCH_QUERY",
|
|
36
|
+
SET_SKELTON_LOADING = "SET_SKELTON_LOADING",
|
|
37
|
+
SET_TAX = "SET_TAX",
|
|
38
|
+
SET_TAXES = "SET_TAXES"
|
|
39
|
+
}
|
|
40
|
+
export type QuoteUpdateFieldAction = {
|
|
41
|
+
type: QUOTE_ACTION_TYPES.SET_INPUT_FIELD;
|
|
42
|
+
payload: {
|
|
43
|
+
key: keyof QuoteInvoiceTypeBE | "servicesList" | "productsList";
|
|
44
|
+
value: string | string[] | boolean | number | number[] | Service[] | Product[];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export type QuoteResetErrorAction = {
|
|
48
|
+
type: QUOTE_ACTION_TYPES.RESET_ERRORS;
|
|
49
|
+
};
|
|
50
|
+
export type QuoteResetFormAction = {
|
|
51
|
+
type: QUOTE_ACTION_TYPES.RESET_FORM;
|
|
52
|
+
};
|
|
53
|
+
export type QuoteSetErrorsAction = {
|
|
54
|
+
type: QUOTE_ACTION_TYPES.SET_ERRORS;
|
|
55
|
+
payload: {
|
|
56
|
+
errors: {
|
|
57
|
+
[key: string]: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export type QuoteSetCurrentPageAction = {
|
|
62
|
+
type: QUOTE_ACTION_TYPES.SET_CURRENT_PAGE;
|
|
63
|
+
payload: {
|
|
64
|
+
currentPage: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export type QuoteSetButtonDisableAction = {
|
|
68
|
+
type: QUOTE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON;
|
|
69
|
+
payload: {
|
|
70
|
+
disableSaveButton: boolean;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export type QuoteSetFormLoadingAction = {
|
|
74
|
+
type: QUOTE_ACTION_TYPES.SET_FORM_LOADING;
|
|
75
|
+
payload: boolean;
|
|
76
|
+
};
|
|
77
|
+
export type QuoteSetMaxPageLimitAction = {
|
|
78
|
+
type: QUOTE_ACTION_TYPES.SET_PAGE_LIMIT;
|
|
79
|
+
payload: {
|
|
80
|
+
pageLimit: number;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export type QuoteSetSearchQueryAction = {
|
|
84
|
+
type: QUOTE_ACTION_TYPES.SET_SEARCH_QUERY;
|
|
85
|
+
payload: {
|
|
86
|
+
searchQuery: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export type QuoteSetQuotesAction = {
|
|
90
|
+
type: QUOTE_ACTION_TYPES.SET_QUOTES;
|
|
91
|
+
payload: {
|
|
92
|
+
quotes: QuoteInvoiceTypeBE[];
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export type QuoteSetCountAction = {
|
|
96
|
+
type: QUOTE_ACTION_TYPES.SET_COUNT;
|
|
97
|
+
payload: {
|
|
98
|
+
count: number;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export type QuoteSetQuoteFormAction = {
|
|
102
|
+
type: QUOTE_ACTION_TYPES.SET_QUOTE_FORM;
|
|
103
|
+
payload: QuoteInvoiceTypeBE;
|
|
104
|
+
};
|
|
105
|
+
export type QuoteToggleLoadingAction = {
|
|
106
|
+
type: QUOTE_ACTION_TYPES.SET_SKELTON_LOADING;
|
|
107
|
+
payload: boolean;
|
|
108
|
+
};
|
|
109
|
+
export type QuoteAddItemServiceAction = {
|
|
110
|
+
type: QUOTE_ACTION_TYPES.ADD_ITEM_SERVICE;
|
|
111
|
+
payload: {
|
|
112
|
+
servicesList: Service[];
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export type QuoteAddItemProductAction = {
|
|
116
|
+
type: QUOTE_ACTION_TYPES.ADD_ITEM_PRODUCT;
|
|
117
|
+
payload: {
|
|
118
|
+
productsList: Product[];
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
export type QuoteDeleteItemProductAction = {
|
|
122
|
+
type: QUOTE_ACTION_TYPES.DELETE_ITEM_PRODUCT;
|
|
123
|
+
payload: {
|
|
124
|
+
productsList: Product[];
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
export type QuoteDeleteItemServiceAction = {
|
|
128
|
+
type: QUOTE_ACTION_TYPES.DELETE_ITEM_SERVICE;
|
|
129
|
+
payload: {
|
|
130
|
+
servicesList: Service[];
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
export type QuoteSetDiscountUnitAction = {
|
|
134
|
+
type: QUOTE_ACTION_TYPES.SET_DISCOUNT_UNIT;
|
|
135
|
+
payload: {
|
|
136
|
+
discountUnit: DISCOUNT_UNIT;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
export type QuoteSetCustomerDataAction = {
|
|
140
|
+
type: QUOTE_ACTION_TYPES.SET_CUSTOMER_DATA;
|
|
141
|
+
payload: QuoteState;
|
|
142
|
+
};
|
|
143
|
+
export type QuoteSetIsQuoteApiSuccessAction = {
|
|
144
|
+
type: QUOTE_ACTION_TYPES.SET_IS_QUOTE_API_SUCCESS;
|
|
145
|
+
payload: boolean;
|
|
146
|
+
};
|
|
147
|
+
export type QuoteSetDrawerAction = {
|
|
148
|
+
type: QUOTE_ACTION_TYPES.SET_DRAWER;
|
|
149
|
+
payload: {
|
|
150
|
+
drawer: QUOTE_DRAWER | null;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
export type QuoteSetFormAction = {
|
|
154
|
+
type: QUOTE_ACTION_TYPES.SET_FORM;
|
|
155
|
+
payload: {
|
|
156
|
+
form: QuoteInvoiceTypeBE;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
export type QuoteSetAfterDiscountAction = {
|
|
160
|
+
type: QUOTE_ACTION_TYPES.SET_AFTER_DISCOUNT;
|
|
161
|
+
payload: {
|
|
162
|
+
afterDiscount: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
export type QuoteSetTaxAction = {
|
|
166
|
+
type: QUOTE_ACTION_TYPES.SET_TAX;
|
|
167
|
+
payload: {
|
|
168
|
+
tax: string;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
export type QuoteSetFormToRenderAction = {
|
|
172
|
+
type: QUOTE_ACTION_TYPES.SET_FORM_TO_RENDER;
|
|
173
|
+
payload: {
|
|
174
|
+
formToRender: string;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
export type QuoteSetProductsListAction = {
|
|
178
|
+
type: QUOTE_ACTION_TYPES.SET_PRODUCTS_LIST;
|
|
179
|
+
payload: {
|
|
180
|
+
list: ProductTypeBE[];
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
export type QuoteSetCompaniesListAction = {
|
|
184
|
+
type: QUOTE_ACTION_TYPES.SET_COMPANIES_LIST;
|
|
185
|
+
payload: {
|
|
186
|
+
companiesList: CompanyTypeBE[];
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
export type QuoteSetCustomerAction = {
|
|
190
|
+
type: QUOTE_ACTION_TYPES.SET_CUSTOMER;
|
|
191
|
+
payload: {
|
|
192
|
+
customer: CustomerTypeBE;
|
|
193
|
+
customerId: string;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
export type QuoteSetCustomerFormAction = {
|
|
197
|
+
type: QUOTE_ACTION_TYPES.SET_CUSTOMER_FORM;
|
|
198
|
+
payload: {
|
|
199
|
+
key: keyof CustomerTypeBE;
|
|
200
|
+
value: string;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
export type QuoteSetTaxesAction = {
|
|
204
|
+
type: QUOTE_ACTION_TYPES.SET_TAXES;
|
|
205
|
+
payload: {
|
|
206
|
+
taxes: TaxTypeBE[];
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
export type QuoteSetModalAction = {
|
|
210
|
+
type: QUOTE_ACTION_TYPES.SET_MODAL;
|
|
211
|
+
payload: {
|
|
212
|
+
modal: QUOTE_MODAL;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
export type QuoteActions = QuoteAddItemProductAction | QuoteAddItemServiceAction | QuoteResetErrorAction | QuoteDeleteItemProductAction | QuoteDeleteItemServiceAction | QuoteResetFormAction | QuoteSetButtonDisableAction | QuoteSetCurrentPageAction | QuoteSetCustomerDataAction | QuoteSetDiscountUnitAction | QuoteSetErrorsAction | QuoteSetFormLoadingAction | QuoteSetQuotesAction | QuoteSetQuoteFormAction | QuoteSetIsQuoteApiSuccessAction | QuoteSetMaxPageLimitAction | QuoteSetSearchQueryAction | QuoteUpdateFieldAction | QuoteToggleLoadingAction | QuoteSetDrawerAction | QuoteSetCountAction | QuoteSetFormAction | QuoteSetAfterDiscountAction | QuoteSetTaxAction | QuoteSetFormToRenderAction | QuoteSetProductsListAction | QuoteSetCustomerAction | QuoteSetTaxesAction | QuoteSetCustomerFormAction | QuoteSetCompaniesListAction | QuoteSetModalAction;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QUOTE_ACTION_TYPES = void 0;
|
|
4
|
+
var QUOTE_ACTION_TYPES;
|
|
5
|
+
(function (QUOTE_ACTION_TYPES) {
|
|
6
|
+
QUOTE_ACTION_TYPES["ADD_ITEM_PRODUCT"] = "ADD_ITEM_PRODUCT";
|
|
7
|
+
QUOTE_ACTION_TYPES["ADD_ITEM_SERVICE"] = "ADD_ITEM_SERVICE";
|
|
8
|
+
QUOTE_ACTION_TYPES["DELETE_ITEM_PRODUCT"] = "DELETE_ITEM_PRODUCT";
|
|
9
|
+
QUOTE_ACTION_TYPES["DELETE_ITEM_SERVICE"] = "DELETE_ITEM_SERVICE";
|
|
10
|
+
QUOTE_ACTION_TYPES["RESET_ERRORS"] = "RESET_ERRORS";
|
|
11
|
+
QUOTE_ACTION_TYPES["RESET_FORM"] = "RESET_FORM";
|
|
12
|
+
QUOTE_ACTION_TYPES["SET_AFTER_DISCOUNT"] = "SET_AFTER_DISCOUNT";
|
|
13
|
+
QUOTE_ACTION_TYPES["SET_BUTTON_DISABLE"] = "SET_BUTTON_DISABLE";
|
|
14
|
+
QUOTE_ACTION_TYPES["SET_COMPANIES_LIST"] = "SET_COMPANIES_LIST";
|
|
15
|
+
QUOTE_ACTION_TYPES["SET_COUNT"] = "SET_COUNT";
|
|
16
|
+
QUOTE_ACTION_TYPES["SET_CURRENT_PAGE"] = "SET_CURRENT_PAGE";
|
|
17
|
+
QUOTE_ACTION_TYPES["SET_CUSTOMER"] = "SET_CUSTOMER";
|
|
18
|
+
QUOTE_ACTION_TYPES["SET_CUSTOMER_DATA"] = "SET_CUSTOMER_DATA";
|
|
19
|
+
QUOTE_ACTION_TYPES["SET_CUSTOMER_FORM"] = "SET_CUSTOMER_FORM";
|
|
20
|
+
QUOTE_ACTION_TYPES["SET_DISABLE_SAVE_BUTTON"] = "SET_DISABLE_SAVE_BUTTON";
|
|
21
|
+
QUOTE_ACTION_TYPES["SET_DISCOUNT_UNIT"] = "SET_DISCOUNT_UNIT";
|
|
22
|
+
QUOTE_ACTION_TYPES["SET_DRAWER"] = "SET_DRAWER";
|
|
23
|
+
QUOTE_ACTION_TYPES["SET_ERRORS"] = "SET_ERRORS";
|
|
24
|
+
QUOTE_ACTION_TYPES["SET_FORM"] = "SET_FORM";
|
|
25
|
+
QUOTE_ACTION_TYPES["SET_FORM_LOADING"] = "SET_FORM_LOADING";
|
|
26
|
+
QUOTE_ACTION_TYPES["SET_FORM_TO_RENDER"] = "SET_FORM_TO_RENDER";
|
|
27
|
+
QUOTE_ACTION_TYPES["SET_INPUT_FIELD"] = "SET_INPUT_FIELD";
|
|
28
|
+
QUOTE_ACTION_TYPES["SET_QUOTES"] = "SET_QUOTES";
|
|
29
|
+
QUOTE_ACTION_TYPES["SET_QUOTE_FORM"] = "SET_QUOTE_FORM";
|
|
30
|
+
QUOTE_ACTION_TYPES["SET_IS_QUOTE_API_SUCCESS"] = "SET_IS_QUOTE_API_SUCCESS";
|
|
31
|
+
QUOTE_ACTION_TYPES["SET_MODAL"] = "SET_MODAL";
|
|
32
|
+
QUOTE_ACTION_TYPES["SET_PAGE_LIMIT"] = "SET_PAGE_LIMIT";
|
|
33
|
+
QUOTE_ACTION_TYPES["SET_PRODUCTS_LIST"] = "SET_PRODUCTS_LIST";
|
|
34
|
+
QUOTE_ACTION_TYPES["SET_SEARCH_QUERY"] = "SET_SEARCH_QUERY";
|
|
35
|
+
QUOTE_ACTION_TYPES["SET_SKELTON_LOADING"] = "SET_SKELTON_LOADING";
|
|
36
|
+
QUOTE_ACTION_TYPES["SET_TAX"] = "SET_TAX";
|
|
37
|
+
QUOTE_ACTION_TYPES["SET_TAXES"] = "SET_TAXES";
|
|
38
|
+
})(QUOTE_ACTION_TYPES || (exports.QUOTE_ACTION_TYPES = QUOTE_ACTION_TYPES = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add Service/Product Section Component
|
|
3
|
+
*
|
|
4
|
+
* Quick action buttons to add new service or product rows to the invoice.
|
|
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 AddServiceProductSection: FC<Props>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Add Service/Product Section Component
|
|
4
|
+
*
|
|
5
|
+
* Quick action buttons to add new service or product rows to the invoice.
|
|
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.AddServiceProductSection = 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 context_1 = require("./context");
|
|
18
|
+
var AddServiceProductSection = function () {
|
|
19
|
+
var t = (0, next_intl_1.useTranslations)("invoicePage");
|
|
20
|
+
var _a = (0, context_1.useQuoteStateContext)(), handleAddItemProduct = _a.handleAddItemProduct, handleAddItemService = _a.handleAddItemService;
|
|
21
|
+
return (react_1.default.createElement("div", { className: "flex items-center justify-center gap-3 rounded-lg border-2 border-dashed border-muted-foreground/25 p-6 hover:border-muted-foreground/50 transition-colors" },
|
|
22
|
+
react_1.default.createElement("span", { className: "text-sm text-muted-foreground" }, t("addItemPrompt")),
|
|
23
|
+
react_1.default.createElement(button_1.Button, { onClick: handleAddItemService, size: "sm", type: "button", variant: "outline" },
|
|
24
|
+
react_1.default.createElement(lucide_react_1.Plus, { className: "h-4 w-4 mr-2" }),
|
|
25
|
+
t("buttonAddService")),
|
|
26
|
+
react_1.default.createElement("span", { className: "text-sm text-muted-foreground" }, t("addItemOr")),
|
|
27
|
+
react_1.default.createElement(button_1.Button, { onClick: handleAddItemProduct, size: "sm", type: "button", variant: "outline" },
|
|
28
|
+
react_1.default.createElement(lucide_react_1.Plus, { className: "h-4 w-4 mr-2" }),
|
|
29
|
+
t("buttonAddProduct"))));
|
|
30
|
+
};
|
|
31
|
+
exports.AddServiceProductSection = AddServiceProductSection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { calculateSubtotal } from "../invoice/calculate-subtotal";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateSubtotal = void 0;
|
|
4
|
+
// Re-export from invoice module since calculation logic is identical
|
|
5
|
+
var calculate_subtotal_1 = require("../invoice/calculate-subtotal");
|
|
6
|
+
Object.defineProperty(exports, "calculateSubtotal", { enumerable: true, get: function () { return calculate_subtotal_1.calculateSubtotal; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { calculateTotal } from "../invoice/calculate-total";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateTotal = void 0;
|
|
4
|
+
// Re-export from invoice module since calculation logic is identical
|
|
5
|
+
var calculate_total_1 = require("../invoice/calculate-total");
|
|
6
|
+
Object.defineProperty(exports, "calculateTotal", { enumerable: true, get: function () { return calculate_total_1.calculateTotal; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Company Form Section Component
|
|
3
|
+
*
|
|
4
|
+
* Form section for creating/editing company invoice information.
|
|
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 CompanySection: FC<Props>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Company Form Section Component
|
|
4
|
+
*
|
|
5
|
+
* Form section for creating/editing company invoice information.
|
|
6
|
+
* Uses Shadcn UI components with RTL support and i18n.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.CompanySection = void 0;
|
|
43
|
+
var react_1 = __importStar(require("react"));
|
|
44
|
+
var next_intl_1 = require("next-intl");
|
|
45
|
+
var date_fns_1 = require("date-fns");
|
|
46
|
+
var combobox_1 = require("@appcorp/shadcn/components/combobox");
|
|
47
|
+
var input_1 = require("@appcorp/shadcn/components/input");
|
|
48
|
+
var textarea_1 = require("@appcorp/shadcn/components/textarea");
|
|
49
|
+
var context_1 = require("@appcorp/stellar-solutions-modules/global-modules/preferences/context");
|
|
50
|
+
var actions_1 = require("./actions");
|
|
51
|
+
var context_2 = require("./context");
|
|
52
|
+
var CompanySection = function () {
|
|
53
|
+
var t = (0, next_intl_1.useTranslations)("invoicePage");
|
|
54
|
+
var currencies = (0, context_1.usePreferenceStateContext)().currencies;
|
|
55
|
+
var _a = (0, context_2.useQuoteStateContext)(), companiesList = _a.companiesList, companyId = _a.companyId, currency = _a.currency, date = _a.date, dispatch = _a.dispatch, errors = _a.errors, expiryDate = _a.expiryDate, note = _a.note, ref = _a.ref;
|
|
56
|
+
var handleInputChange = (0, react_1.useCallback)(function (key, value) {
|
|
57
|
+
dispatch({
|
|
58
|
+
type: actions_1.QUOTE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
59
|
+
payload: { key: key, value: value },
|
|
60
|
+
});
|
|
61
|
+
dispatch({
|
|
62
|
+
type: actions_1.QUOTE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
63
|
+
payload: { disableSaveButton: false },
|
|
64
|
+
});
|
|
65
|
+
dispatch({
|
|
66
|
+
type: actions_1.QUOTE_ACTION_TYPES.RESET_ERRORS,
|
|
67
|
+
});
|
|
68
|
+
}, [dispatch]);
|
|
69
|
+
var handleCompanyChange = function (selectedCompanyId) {
|
|
70
|
+
dispatch({
|
|
71
|
+
type: actions_1.QUOTE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
72
|
+
payload: { key: "companyId", value: selectedCompanyId },
|
|
73
|
+
});
|
|
74
|
+
dispatch({
|
|
75
|
+
type: actions_1.QUOTE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
76
|
+
payload: { disableSaveButton: false },
|
|
77
|
+
});
|
|
78
|
+
dispatch({
|
|
79
|
+
type: actions_1.QUOTE_ACTION_TYPES.RESET_ERRORS,
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
var handleCompanySearch = function (searchQuery) {
|
|
83
|
+
dispatch({
|
|
84
|
+
type: actions_1.QUOTE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
85
|
+
payload: {
|
|
86
|
+
key: "companyQuery",
|
|
87
|
+
value: searchQuery,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
var handleCurrencyChange = function (currencyCode) {
|
|
92
|
+
dispatch({
|
|
93
|
+
type: actions_1.QUOTE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
94
|
+
payload: { key: "currency", value: currencyCode },
|
|
95
|
+
});
|
|
96
|
+
dispatch({
|
|
97
|
+
type: actions_1.QUOTE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
98
|
+
payload: { disableSaveButton: false },
|
|
99
|
+
});
|
|
100
|
+
dispatch({
|
|
101
|
+
type: actions_1.QUOTE_ACTION_TYPES.RESET_ERRORS,
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
// Map currencies to have consistent structure for CompanyCombobox
|
|
105
|
+
var currencyOptions = (currencies || []).map(function (curr) { return ({
|
|
106
|
+
id: curr.code,
|
|
107
|
+
name: curr.code,
|
|
108
|
+
}); });
|
|
109
|
+
return (react_1.default.createElement("div", { className: "flex flex-col gap-4" },
|
|
110
|
+
react_1.default.createElement("h3", { className: "text-lg font-semibold border-b pb-2" }, t("companySectionTitle")),
|
|
111
|
+
react_1.default.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4" },
|
|
112
|
+
react_1.default.createElement("div", { className: "space-y-2" },
|
|
113
|
+
react_1.default.createElement(combobox_1.CompanyCombobox, { companies: companiesList || [], error: errors.companyId, id: "companyId", label: t("formLabelCompany"), onSearchChange: handleCompanySearch, onValueChange: handleCompanyChange, placeholder: t("formPlaceholderCompany"), required: true, value: companyId || "" })),
|
|
114
|
+
react_1.default.createElement("div", { className: "space-y-2" },
|
|
115
|
+
react_1.default.createElement(input_1.Input, { error: errors.date, id: "date", label: t("formLabelDate"), onChange: function (e) { return handleInputChange("date", e.target.value); }, required: true, type: "date", value: date ? (0, date_fns_1.format)(new Date(date), "yyyy-MM-dd") : "" })),
|
|
116
|
+
react_1.default.createElement("div", { className: "space-y-2" },
|
|
117
|
+
react_1.default.createElement(input_1.Input, { error: errors.expiryDate, id: "expiryDate", label: t("formLabelExpiryDate"), onChange: function (e) { return handleInputChange("expiryDate", e.target.value); }, required: true, type: "date", value: expiryDate ? (0, date_fns_1.format)(new Date(expiryDate), "yyyy-MM-dd") : "" })),
|
|
118
|
+
react_1.default.createElement("div", { className: "space-y-2" },
|
|
119
|
+
react_1.default.createElement(combobox_1.CompanyCombobox, { companies: currencyOptions, error: errors.currency, id: "currency", label: t("formLabelCurrency"), onSearchChange: function () { }, onValueChange: handleCurrencyChange, placeholder: t("formPlaceholderCurrency"), required: true, value: currency || "" })),
|
|
120
|
+
react_1.default.createElement("div", { className: "space-y-2" },
|
|
121
|
+
react_1.default.createElement(textarea_1.Textarea, { error: errors.note, id: "note", label: t("formLabelNote"), onChange: function (e) { return handleInputChange("note", e.target.value); }, placeholder: t("formPlaceholderNote"), rows: 3, value: note || "" })),
|
|
122
|
+
react_1.default.createElement("div", { className: "space-y-2" },
|
|
123
|
+
react_1.default.createElement(input_1.Input, { error: errors.ref, id: "ref", label: t("formLabelRef"), onChange: function (e) { return handleInputChange("ref", e.target.value); }, readOnly: true, required: true, type: "text", value: ref || "" })))));
|
|
124
|
+
};
|
|
125
|
+
exports.CompanySection = CompanySection;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
|
|
2
|
+
export declare const pageLimit: number;
|
|
3
|
+
export declare const handleSplitId: (value: string) => string[];
|
|
4
|
+
export declare const changeActionsMap: Record<string, (val: string | number | number[]) => string | number | number[]>;
|
|
5
|
+
export declare const QUOTE_API_ROUTES: {
|
|
6
|
+
QUOTES: string;
|
|
7
|
+
QUOTE: string;
|
|
8
|
+
QUOTE_BY_ID: string;
|
|
9
|
+
PRODUCTS: string;
|
|
10
|
+
CONTACTS: string;
|
|
11
|
+
CUSTOMER_BY_PHONE: string;
|
|
12
|
+
TAXES: string;
|
|
13
|
+
TAX: string;
|
|
14
|
+
COMPANIES: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const tableBodyCols: ({
|
|
17
|
+
componentType: COMPONENT_TYPE;
|
|
18
|
+
key: string;
|
|
19
|
+
textFormatter?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
componentType: COMPONENT_TYPE;
|
|
22
|
+
key: string[];
|
|
23
|
+
textFormatter?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
componentType: COMPONENT_TYPE;
|
|
26
|
+
key: string[];
|
|
27
|
+
textFormatter: (text: unknown) => string;
|
|
28
|
+
} | {
|
|
29
|
+
componentType: COMPONENT_TYPE;
|
|
30
|
+
key: string;
|
|
31
|
+
textFormatter: (text: unknown, obj: unknown) => string;
|
|
32
|
+
})[];
|
|
33
|
+
export declare const validationErrors: {
|
|
34
|
+
companyId: string;
|
|
35
|
+
ref: string;
|
|
36
|
+
status: string;
|
|
37
|
+
date: string;
|
|
38
|
+
expiryDate: string;
|
|
39
|
+
note: string;
|
|
40
|
+
currency: string;
|
|
41
|
+
total: string;
|
|
42
|
+
subTotal: string;
|
|
43
|
+
taxRate: string;
|
|
44
|
+
customerPhone: string;
|
|
45
|
+
customerFirstName: string;
|
|
46
|
+
customerLastName: string;
|
|
47
|
+
customerAddress: string;
|
|
48
|
+
customerCity: string;
|
|
49
|
+
customerCountry: string;
|
|
50
|
+
customerEmail: string;
|
|
51
|
+
services: {
|
|
52
|
+
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
quantity: string;
|
|
55
|
+
price: string;
|
|
56
|
+
total: string;
|
|
57
|
+
};
|
|
58
|
+
products: {
|
|
59
|
+
id: string;
|
|
60
|
+
quantity: string;
|
|
61
|
+
price: string;
|
|
62
|
+
total: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validationErrors = exports.tableBodyCols = exports.QUOTE_API_ROUTES = exports.changeActionsMap = exports.handleSplitId = exports.pageLimit = void 0;
|
|
4
|
+
var util_functions_1 = require("@react-pakistan/util-functions");
|
|
5
|
+
var enhanced_table_1 = require("@appcorp/shadcn/components/enhanced-table");
|
|
6
|
+
exports.pageLimit = Number(process.env.NEXT_PUBLIC_PAGE_LIMIT);
|
|
7
|
+
var handleSplitId = function (value) {
|
|
8
|
+
return value === null || value === void 0 ? void 0 : value.split(util_functions_1.VALUE_DELIMITER.COLON);
|
|
9
|
+
};
|
|
10
|
+
exports.handleSplitId = handleSplitId;
|
|
11
|
+
exports.changeActionsMap = {
|
|
12
|
+
companyId: function (val) { return (0, exports.handleSplitId)(val)[1]; },
|
|
13
|
+
};
|
|
14
|
+
exports.QUOTE_API_ROUTES = {
|
|
15
|
+
QUOTES: "/api/quotes-invoices",
|
|
16
|
+
QUOTE: "/api/quote-invoice",
|
|
17
|
+
QUOTE_BY_ID: "/api/quote-invoice/quote-invoice-by-id",
|
|
18
|
+
PRODUCTS: "/api/products",
|
|
19
|
+
CONTACTS: "/api/contacts",
|
|
20
|
+
CUSTOMER_BY_PHONE: "/api/customer/customer-by-phone",
|
|
21
|
+
TAXES: "/api/taxes",
|
|
22
|
+
TAX: "/api/tax",
|
|
23
|
+
COMPANIES: "/api/companies",
|
|
24
|
+
};
|
|
25
|
+
exports.tableBodyCols = [
|
|
26
|
+
{
|
|
27
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.ID,
|
|
28
|
+
key: "id",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.OBJECT,
|
|
32
|
+
key: ["company", "name"],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.MULTIPLE_TEXT_LINES,
|
|
36
|
+
key: ["date", "expiryDate"],
|
|
37
|
+
textFormatter: function (text) {
|
|
38
|
+
return (0, util_functions_1.formatDate)(text, util_functions_1.DATE_FORMATS.LOCALE_DATE);
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
43
|
+
key: "ref",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
47
|
+
key: "subTotal",
|
|
48
|
+
textFormatter: function (text, obj) {
|
|
49
|
+
return "".concat(obj === null || obj === void 0 ? void 0 : obj.currency).concat(text);
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
54
|
+
key: "taxRate",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
58
|
+
key: "discount",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
62
|
+
key: "total",
|
|
63
|
+
textFormatter: function (text, obj) {
|
|
64
|
+
return "".concat(obj === null || obj === void 0 ? void 0 : obj.currency).concat(text);
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.TEXT,
|
|
69
|
+
key: "category",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
componentType: enhanced_table_1.COMPONENT_TYPE.ACTIONS,
|
|
73
|
+
key: "actions",
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
exports.validationErrors = {
|
|
77
|
+
companyId: "Please select Company",
|
|
78
|
+
ref: "Please enter ref",
|
|
79
|
+
status: "Please select status",
|
|
80
|
+
date: "Please select date",
|
|
81
|
+
expiryDate: "Please select expire date",
|
|
82
|
+
note: "Please enter a note",
|
|
83
|
+
currency: "Please select currency",
|
|
84
|
+
total: "Please enter net total",
|
|
85
|
+
subTotal: "Please enter sub total",
|
|
86
|
+
taxRate: "Please enter tax value",
|
|
87
|
+
customerPhone: "Please enter phone",
|
|
88
|
+
customerFirstName: "Please enter first name",
|
|
89
|
+
customerLastName: "Please enter last name",
|
|
90
|
+
customerAddress: "Please enter address",
|
|
91
|
+
customerCity: "Please enter city",
|
|
92
|
+
customerCountry: "Please enter country",
|
|
93
|
+
customerEmail: "Please enter email",
|
|
94
|
+
services: {
|
|
95
|
+
name: "Item is required",
|
|
96
|
+
description: "Description is required",
|
|
97
|
+
quantity: "Quantity is required",
|
|
98
|
+
price: "Price is required",
|
|
99
|
+
total: "Total price is required",
|
|
100
|
+
},
|
|
101
|
+
products: {
|
|
102
|
+
id: "Please select a product",
|
|
103
|
+
quantity: "Please enter Quantity",
|
|
104
|
+
price: "Price is required",
|
|
105
|
+
total: "Total price is required",
|
|
106
|
+
},
|
|
107
|
+
};
|