@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
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 {};
|
|
@@ -1,21 +1,31 @@
|
|
|
1
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
|
+
*/
|
|
2
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
10
|
};
|
|
5
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
12
|
exports.AddServiceProductSection = void 0;
|
|
7
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");
|
|
8
17
|
var context_1 = require("./context");
|
|
9
18
|
var AddServiceProductSection = function () {
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
react_1.default.createElement(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
var t = (0, next_intl_1.useTranslations)("invoicePage");
|
|
20
|
+
var _a = (0, context_1.useInvoiceStateContext)(), 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"))));
|
|
20
30
|
};
|
|
21
31
|
exports.AddServiceProductSection = AddServiceProductSection;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 {};
|
|
@@ -1,17 +1,125 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
})();
|
|
5
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
42
|
exports.CompanySection = void 0;
|
|
7
|
-
var react_1 =
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
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");
|
|
11
52
|
var CompanySection = function () {
|
|
12
|
-
var
|
|
53
|
+
var t = (0, next_intl_1.useTranslations)("invoicePage");
|
|
54
|
+
var currencies = (0, context_1.usePreferenceStateContext)().currencies;
|
|
55
|
+
var _a = (0, context_2.useInvoiceStateContext)(), 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.INVOICE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
59
|
+
payload: { key: key, value: value },
|
|
60
|
+
});
|
|
61
|
+
dispatch({
|
|
62
|
+
type: actions_1.INVOICE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
63
|
+
payload: { disableSaveButton: false },
|
|
64
|
+
});
|
|
65
|
+
dispatch({
|
|
66
|
+
type: actions_1.INVOICE_ACTION_TYPES.RESET_ERRORS,
|
|
67
|
+
});
|
|
68
|
+
}, [dispatch]);
|
|
69
|
+
var handleCompanyChange = function (selectedCompanyId) {
|
|
70
|
+
dispatch({
|
|
71
|
+
type: actions_1.INVOICE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
72
|
+
payload: { key: "companyId", value: selectedCompanyId },
|
|
73
|
+
});
|
|
74
|
+
dispatch({
|
|
75
|
+
type: actions_1.INVOICE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
76
|
+
payload: { disableSaveButton: false },
|
|
77
|
+
});
|
|
78
|
+
dispatch({
|
|
79
|
+
type: actions_1.INVOICE_ACTION_TYPES.RESET_ERRORS,
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
var handleCompanySearch = function (searchQuery) {
|
|
83
|
+
dispatch({
|
|
84
|
+
type: actions_1.INVOICE_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.INVOICE_ACTION_TYPES.SET_INPUT_FIELD,
|
|
94
|
+
payload: { key: "currency", value: currencyCode },
|
|
95
|
+
});
|
|
96
|
+
dispatch({
|
|
97
|
+
type: actions_1.INVOICE_ACTION_TYPES.SET_DISABLE_SAVE_BUTTON,
|
|
98
|
+
payload: { disableSaveButton: false },
|
|
99
|
+
});
|
|
100
|
+
dispatch({
|
|
101
|
+
type: actions_1.INVOICE_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
|
+
}); });
|
|
13
109
|
return (react_1.default.createElement("div", { className: "flex flex-col gap-4" },
|
|
14
|
-
react_1.default.createElement(
|
|
15
|
-
(
|
|
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 || "" })))));
|
|
16
124
|
};
|
|
17
125
|
exports.CompanySection = CompanySection;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { VISTA_TABLE_CELL_TYPE } from '@appcorp/app-corp-vista/type/vista-table-type';
|
|
1
|
+
import { COMPONENT_TYPE } from "@appcorp/shadcn/components/enhanced-table";
|
|
3
2
|
export declare const pageLimit: number;
|
|
4
3
|
export declare const handleSplitId: (value: string) => string[];
|
|
5
4
|
export declare const changeActionsMap: Record<string, (val: string | number | number[]) => string | number | number[]>;
|
|
6
|
-
export declare const staticCompanySection: VistaFormElements;
|
|
7
|
-
export declare const staticCustomerSection: VistaFormElements;
|
|
8
|
-
export declare const staticPricingSection: VistaFormElements;
|
|
9
|
-
export declare const staticServiceSection: VistaFormElements;
|
|
10
|
-
export declare const staticProductSection: VistaFormElements;
|
|
11
5
|
export declare const INVOICE_API_ROUTES: {
|
|
12
6
|
INVOICES: string;
|
|
13
7
|
INVOICE: string;
|
|
@@ -20,32 +14,22 @@ export declare const INVOICE_API_ROUTES: {
|
|
|
20
14
|
COMPANIES: string;
|
|
21
15
|
};
|
|
22
16
|
export declare const tableBodyCols: ({
|
|
23
|
-
componentType:
|
|
17
|
+
componentType: COMPONENT_TYPE;
|
|
24
18
|
key: string;
|
|
25
|
-
|
|
19
|
+
textFormatter?: undefined;
|
|
26
20
|
} | {
|
|
27
|
-
componentType:
|
|
21
|
+
componentType: COMPONENT_TYPE;
|
|
28
22
|
key: string[];
|
|
29
|
-
|
|
23
|
+
textFormatter?: undefined;
|
|
30
24
|
} | {
|
|
31
|
-
componentType:
|
|
25
|
+
componentType: COMPONENT_TYPE;
|
|
32
26
|
key: string[];
|
|
33
|
-
|
|
27
|
+
textFormatter: (text: unknown) => string;
|
|
34
28
|
} | {
|
|
35
|
-
componentType:
|
|
29
|
+
componentType: COMPONENT_TYPE;
|
|
36
30
|
key: string;
|
|
37
|
-
|
|
38
|
-
currency: string;
|
|
39
|
-
}) => string;
|
|
40
|
-
} | {
|
|
41
|
-
componentType: VISTA_TABLE_CELL_TYPE;
|
|
42
|
-
key?: undefined;
|
|
43
|
-
expression?: undefined;
|
|
31
|
+
textFormatter: (text: unknown, obj: unknown) => string;
|
|
44
32
|
})[];
|
|
45
|
-
export declare const networkMessages: {
|
|
46
|
-
error: string;
|
|
47
|
-
success: string;
|
|
48
|
-
};
|
|
49
33
|
export declare const validationErrors: {
|
|
50
34
|
companyId: string;
|
|
51
35
|
ref: string;
|
|
@@ -57,6 +41,13 @@ export declare const validationErrors: {
|
|
|
57
41
|
total: string;
|
|
58
42
|
subTotal: string;
|
|
59
43
|
taxRate: string;
|
|
44
|
+
customerPhone: string;
|
|
45
|
+
customerFirstName: string;
|
|
46
|
+
customerLastName: string;
|
|
47
|
+
customerAddress: string;
|
|
48
|
+
customerCity: string;
|
|
49
|
+
customerCountry: string;
|
|
50
|
+
customerEmail: string;
|
|
60
51
|
services: {
|
|
61
52
|
name: string;
|
|
62
53
|
description: string;
|
|
@@ -67,5 +58,7 @@ export declare const validationErrors: {
|
|
|
67
58
|
products: {
|
|
68
59
|
id: string;
|
|
69
60
|
quantity: string;
|
|
61
|
+
price: string;
|
|
62
|
+
total: string;
|
|
70
63
|
};
|
|
71
64
|
};
|