law-common 8.8.1-beta.1 → 8.8.1-beta.2
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/dist/src/api/interface/billing.entity.response.d.ts +9 -3
- package/dist/src/constants/index.d.ts +1 -0
- package/dist/src/constants/index.js +1 -0
- package/dist/src/constants/util.constants.d.ts +2 -0
- package/dist/src/constants/util.constants.js +37 -0
- package/dist/src/entities/enums/billing.action.enum.d.ts +1 -3
- package/dist/src/entities/enums/billing.action.enum.js +4 -4
- package/dist/src/entities/interface/entity.utils.interface.d.ts +28 -1
- package/dist/src/entities/interface/entity.utils.interface.js +7 -0
- package/dist/src/utils/helper.fn.util.d.ts +29 -0
- package/dist/src/utils/helper.fn.util.js +73 -0
- package/package.json +1 -1
|
@@ -8,12 +8,18 @@ export type IBillingEntityResponse = {
|
|
|
8
8
|
billing: IBillingApiEntity;
|
|
9
9
|
billingTimesheets: IBillingTimesheetApiEntity[];
|
|
10
10
|
};
|
|
11
|
-
export interface
|
|
12
|
-
billings: IBillingEntityResponse[];
|
|
11
|
+
export interface IUserRelationEntity {
|
|
13
12
|
users?: IUserApiEntity[];
|
|
13
|
+
}
|
|
14
|
+
export interface IProjectRelationEntity {
|
|
14
15
|
projects?: IProjectApiEntity[];
|
|
15
16
|
}
|
|
16
|
-
export interface
|
|
17
|
+
export interface IBillingRelationEntity extends IUserRelationEntity, IProjectRelationEntity {
|
|
18
|
+
}
|
|
19
|
+
export interface IBillingEntitySearchResponse extends IBillingRelationEntity {
|
|
20
|
+
billings: IBillingEntityResponse[];
|
|
21
|
+
}
|
|
22
|
+
export interface IBillingEntitySearchResponseInclude extends IBillingRelationEntity {
|
|
17
23
|
}
|
|
18
24
|
export type IBillingFlowConfig = {
|
|
19
25
|
[key in BillingStatusEnum]?: {
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./constants"), exports);
|
|
18
18
|
__exportStar(require("./entity_constants"), exports);
|
|
19
|
+
__exportStar(require("./util.constants"), exports);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tensValues = exports.onesValues = void 0;
|
|
4
|
+
exports.onesValues = [
|
|
5
|
+
"",
|
|
6
|
+
"One",
|
|
7
|
+
"Two",
|
|
8
|
+
"Three",
|
|
9
|
+
"Four",
|
|
10
|
+
"Five",
|
|
11
|
+
"Six",
|
|
12
|
+
"Seven",
|
|
13
|
+
"Eight",
|
|
14
|
+
"Nine",
|
|
15
|
+
"Ten",
|
|
16
|
+
"Eleven",
|
|
17
|
+
"Twelve",
|
|
18
|
+
"Thirteen",
|
|
19
|
+
"Fourteen",
|
|
20
|
+
"Fifteen",
|
|
21
|
+
"Sixteen",
|
|
22
|
+
"Seventeen",
|
|
23
|
+
"Eighteen",
|
|
24
|
+
"Nineteen",
|
|
25
|
+
];
|
|
26
|
+
exports.tensValues = [
|
|
27
|
+
"",
|
|
28
|
+
"",
|
|
29
|
+
"Twenty",
|
|
30
|
+
"Thirty",
|
|
31
|
+
"Forty",
|
|
32
|
+
"Fifty",
|
|
33
|
+
"Sixty",
|
|
34
|
+
"Seventy",
|
|
35
|
+
"Eighty",
|
|
36
|
+
"Ninety",
|
|
37
|
+
];
|
|
@@ -12,9 +12,7 @@ export declare enum BillingActionsEnum {
|
|
|
12
12
|
CREDIT_NOTE = "creditNote",
|
|
13
13
|
WRITE_OFF = "writeOff",
|
|
14
14
|
TDS = "tds",
|
|
15
|
-
PDF_VIEW = "pdfView"
|
|
16
|
-
PDF_GENERATE = "pdfGenerate",
|
|
17
|
-
PDF_DELETE = "pdfDelete"
|
|
15
|
+
PDF_VIEW = "pdfView"
|
|
18
16
|
}
|
|
19
17
|
export declare namespace BillingActionsEnum {
|
|
20
18
|
function getLabel(action: BillingActionsEnum): string;
|
|
@@ -19,8 +19,8 @@ var BillingActionsEnum;
|
|
|
19
19
|
BillingActionsEnum["WRITE_OFF"] = "writeOff";
|
|
20
20
|
BillingActionsEnum["TDS"] = "tds";
|
|
21
21
|
BillingActionsEnum["PDF_VIEW"] = "pdfView";
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
// PDF_GENERATE = "pdfGenerate",
|
|
23
|
+
// PDF_DELETE = "pdfDelete",
|
|
24
24
|
})(BillingActionsEnum || (exports.BillingActionsEnum = BillingActionsEnum = {}));
|
|
25
25
|
(function (BillingActionsEnum) {
|
|
26
26
|
const actionLabelMap = {
|
|
@@ -37,8 +37,8 @@ var BillingActionsEnum;
|
|
|
37
37
|
[BillingActionsEnum.CREDIT_NOTE]: "Credit Note",
|
|
38
38
|
[BillingActionsEnum.WRITE_OFF]: "Write Off",
|
|
39
39
|
[BillingActionsEnum.TDS]: "TDS",
|
|
40
|
-
[BillingActionsEnum.PDF_DELETE]: "Pdf Delete",
|
|
41
|
-
[BillingActionsEnum.PDF_GENERATE]: "Pdf Generate",
|
|
40
|
+
// [BillingActionsEnum.PDF_DELETE]: "Pdf Delete",
|
|
41
|
+
// [BillingActionsEnum.PDF_GENERATE]: "Pdf Generate",
|
|
42
42
|
[BillingActionsEnum.PDF_VIEW]: "Pdf View",
|
|
43
43
|
};
|
|
44
44
|
function getLabel(action) {
|
|
@@ -3,6 +3,11 @@ import { Modify } from "../../misc/interface/modify.interface";
|
|
|
3
3
|
import { EntitySearchConstraintTypeEnum } from "../enums/entity_search_constraint_type.enum";
|
|
4
4
|
import { HistoryOperationEnum } from "../enums/history_operation.enum";
|
|
5
5
|
import { IAuditColumnEntity } from "./audit-column.entity.interface";
|
|
6
|
+
import { IBillingEntity } from "./billing.entity.interface";
|
|
7
|
+
import { IBillingTimesheetEntity } from "./billing_timesheet.entity.interface";
|
|
8
|
+
import { IProjectEntity } from "./project.entity.interface";
|
|
9
|
+
import { ITimesheetEntity } from "./timesheet.entity.interface";
|
|
10
|
+
import { IUserEntity } from "./user.entity.interface";
|
|
6
11
|
export type IApiEntity<T extends {
|
|
7
12
|
createdOn: Date;
|
|
8
13
|
updatedOn: Date;
|
|
@@ -14,15 +19,37 @@ export type IEntityCreateDto<T> = Omit<T, "id" | keyof IAuditColumnEntity>;
|
|
|
14
19
|
export type IEntityUpdateDto<T> = Omit<Partial<T>, "id" | keyof IAuditColumnEntity>;
|
|
15
20
|
export declare enum EntityEnum {
|
|
16
21
|
BILLING = "billing",
|
|
22
|
+
BILLING_TIMESHEET = "billing_timesheet",
|
|
23
|
+
TIMESHEET = "timesheet",
|
|
17
24
|
USER = "user",
|
|
18
25
|
PROJECT = "project",
|
|
19
26
|
CLIENT = "client",
|
|
20
27
|
TASK = "task",
|
|
21
28
|
DESIGNATION = "designation",
|
|
22
|
-
RATE = "rate"
|
|
29
|
+
RATE = "rate",
|
|
30
|
+
REIMBURSEMENT = "reimbursement",
|
|
31
|
+
REIMBURSEMENT_EXPENSE = "reimbursement_expense",
|
|
32
|
+
WORK_FROM_HOME = "work_from_home",
|
|
33
|
+
LEAVE = "leave",
|
|
34
|
+
ORGANIZATION = "organization"
|
|
23
35
|
}
|
|
24
36
|
export type ISearchIncludeEntity = {
|
|
25
37
|
name: EntityEnum;
|
|
38
|
+
mappingProperties?: string[];
|
|
39
|
+
searchProperty?: string;
|
|
40
|
+
relations?: ISearchIncludeEntity[];
|
|
41
|
+
entities?: ISearchIncludeEntity[];
|
|
42
|
+
};
|
|
43
|
+
export type IEntityServiceResponse = {
|
|
44
|
+
[EntityEnum.BILLING]?: IBaseEntityServiceResponse<IBillingEntity>;
|
|
45
|
+
[EntityEnum.BILLING_TIMESHEET]?: IBaseEntityServiceResponse<IBillingTimesheetEntity>;
|
|
46
|
+
[EntityEnum.TIMESHEET]?: IBaseEntityServiceResponse<ITimesheetEntity>;
|
|
47
|
+
[EntityEnum.USER]?: IBaseEntityServiceResponse<IUserEntity>;
|
|
48
|
+
[EntityEnum.PROJECT]?: IBaseEntityServiceResponse<IProjectEntity>;
|
|
49
|
+
};
|
|
50
|
+
export type IBaseEntityServiceResponse<T> = {
|
|
51
|
+
baseEntities: T[];
|
|
52
|
+
relatedEntities?: IEntityServiceResponse;
|
|
26
53
|
};
|
|
27
54
|
export type IEntityApiResponse<T extends {
|
|
28
55
|
createdOn: Date;
|
|
@@ -4,10 +4,17 @@ exports.EntityEnum = void 0;
|
|
|
4
4
|
var EntityEnum;
|
|
5
5
|
(function (EntityEnum) {
|
|
6
6
|
EntityEnum["BILLING"] = "billing";
|
|
7
|
+
EntityEnum["BILLING_TIMESHEET"] = "billing_timesheet";
|
|
8
|
+
EntityEnum["TIMESHEET"] = "timesheet";
|
|
7
9
|
EntityEnum["USER"] = "user";
|
|
8
10
|
EntityEnum["PROJECT"] = "project";
|
|
9
11
|
EntityEnum["CLIENT"] = "client";
|
|
10
12
|
EntityEnum["TASK"] = "task";
|
|
11
13
|
EntityEnum["DESIGNATION"] = "designation";
|
|
12
14
|
EntityEnum["RATE"] = "rate";
|
|
15
|
+
EntityEnum["REIMBURSEMENT"] = "reimbursement";
|
|
16
|
+
EntityEnum["REIMBURSEMENT_EXPENSE"] = "reimbursement_expense";
|
|
17
|
+
EntityEnum["WORK_FROM_HOME"] = "work_from_home";
|
|
18
|
+
EntityEnum["LEAVE"] = "leave";
|
|
19
|
+
EntityEnum["ORGANIZATION"] = "organization";
|
|
13
20
|
})(EntityEnum || (exports.EntityEnum = EntityEnum = {}));
|
|
@@ -137,3 +137,32 @@ export declare function getPropertyFilterByPermissionFn<T>(permissionFilterConfi
|
|
|
137
137
|
* console.log(user); // Output: { name: 'Alice', age: 30 }
|
|
138
138
|
*/
|
|
139
139
|
export declare function setResponseValue<K extends keyof T, T>(obj: T, key: K, value: T[K]): void;
|
|
140
|
+
/**
|
|
141
|
+
* Converts a numeric string into words following the Indian numbering system.
|
|
142
|
+
*
|
|
143
|
+
* @param {string} numStr - The number in string format. Can contain commas (e.g., "1,23,456").
|
|
144
|
+
*
|
|
145
|
+
* @returns {string} The number expressed in words using the Indian format (e.g., Crores, Lakhs).
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* const ones = ["", "One", "Two", "Three", ..., "Nineteen"];
|
|
149
|
+
* const tens = ["", "", "Twenty", "Thirty", ..., "Ninety"];
|
|
150
|
+
*
|
|
151
|
+
* numberToWordsIndian("1,23,456", ones, tens);
|
|
152
|
+
* // Output: "One Lakh Twenty Three Thousand Four Hundred Fifty Six"
|
|
153
|
+
*/
|
|
154
|
+
export declare function numberToWordsIndian(numStr: string): string;
|
|
155
|
+
/**
|
|
156
|
+
* Converts a total number of minutes into a formatted "HH:MM" string.
|
|
157
|
+
*
|
|
158
|
+
* @param {number} totalMinutes - The total number of minutes to convert.
|
|
159
|
+
*
|
|
160
|
+
* @returns {string} A string representing the equivalent time in "HH:MM" format,
|
|
161
|
+
* with hours and minutes padded to two digits.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* minutesToHoursMinutes(75); // Output: "01:15"
|
|
165
|
+
* minutesToHoursMinutes(5); // Output: "00:05"
|
|
166
|
+
* minutesToHoursMinutes(135);// Output: "02:15"
|
|
167
|
+
*/
|
|
168
|
+
export declare function minutesToHoursMinutes(totalMinutes: number): string;
|
|
@@ -27,6 +27,9 @@ exports.getFilterByPermission = getFilterByPermission;
|
|
|
27
27
|
exports.getFilterByPermissionFn = getFilterByPermissionFn;
|
|
28
28
|
exports.getPropertyFilterByPermissionFn = getPropertyFilterByPermissionFn;
|
|
29
29
|
exports.setResponseValue = setResponseValue;
|
|
30
|
+
exports.numberToWordsIndian = numberToWordsIndian;
|
|
31
|
+
exports.minutesToHoursMinutes = minutesToHoursMinutes;
|
|
32
|
+
const util_constants_1 = require("../constants/util.constants");
|
|
30
33
|
function groupByFunction(list, keyGetter) {
|
|
31
34
|
const map = new Map();
|
|
32
35
|
list.forEach((item) => {
|
|
@@ -281,3 +284,73 @@ function getPropertyFilterByPermissionFn(permissionFilterConfig_1, propertyNames
|
|
|
281
284
|
function setResponseValue(obj, key, value) {
|
|
282
285
|
obj[key] = value;
|
|
283
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Converts a numeric string into words following the Indian numbering system.
|
|
289
|
+
*
|
|
290
|
+
* @param {string} numStr - The number in string format. Can contain commas (e.g., "1,23,456").
|
|
291
|
+
*
|
|
292
|
+
* @returns {string} The number expressed in words using the Indian format (e.g., Crores, Lakhs).
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* const ones = ["", "One", "Two", "Three", ..., "Nineteen"];
|
|
296
|
+
* const tens = ["", "", "Twenty", "Thirty", ..., "Ninety"];
|
|
297
|
+
*
|
|
298
|
+
* numberToWordsIndian("1,23,456", ones, tens);
|
|
299
|
+
* // Output: "One Lakh Twenty Three Thousand Four Hundred Fifty Six"
|
|
300
|
+
*/
|
|
301
|
+
function numberToWordsIndian(numStr) {
|
|
302
|
+
const ones = util_constants_1.onesValues;
|
|
303
|
+
const tens = util_constants_1.tensValues;
|
|
304
|
+
function twoDigits(n) {
|
|
305
|
+
if (n < 20)
|
|
306
|
+
return ones[n];
|
|
307
|
+
return tens[Math.floor(n / 10)] + (n % 10 !== 0 ? " " + ones[n % 10] : "");
|
|
308
|
+
}
|
|
309
|
+
function threeDigits(n) {
|
|
310
|
+
if (n < 100)
|
|
311
|
+
return twoDigits(n);
|
|
312
|
+
return (ones[Math.floor(n / 100)] +
|
|
313
|
+
" Hundred" +
|
|
314
|
+
(n % 100 !== 0 ? " " + twoDigits(n % 100) : ""));
|
|
315
|
+
}
|
|
316
|
+
// Remove commas and convert to number
|
|
317
|
+
const num = parseInt(numStr.replace(/,/g, ""), 10);
|
|
318
|
+
if (isNaN(num))
|
|
319
|
+
return "Invalid number";
|
|
320
|
+
if (num === 0)
|
|
321
|
+
return "Zero";
|
|
322
|
+
const crore = Math.floor(num / 10000000);
|
|
323
|
+
const lakh = Math.floor((num % 10000000) / 100000);
|
|
324
|
+
const thousand = Math.floor((num % 100000) / 1000);
|
|
325
|
+
const hundred = num % 1000;
|
|
326
|
+
let words = "";
|
|
327
|
+
if (crore)
|
|
328
|
+
words += threeDigits(crore) + " Crore ";
|
|
329
|
+
if (lakh)
|
|
330
|
+
words += threeDigits(lakh) + " Lakh ";
|
|
331
|
+
if (thousand)
|
|
332
|
+
words += threeDigits(thousand) + " Thousand ";
|
|
333
|
+
if (hundred)
|
|
334
|
+
words += threeDigits(hundred);
|
|
335
|
+
return words.trim();
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Converts a total number of minutes into a formatted "HH:MM" string.
|
|
339
|
+
*
|
|
340
|
+
* @param {number} totalMinutes - The total number of minutes to convert.
|
|
341
|
+
*
|
|
342
|
+
* @returns {string} A string representing the equivalent time in "HH:MM" format,
|
|
343
|
+
* with hours and minutes padded to two digits.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* minutesToHoursMinutes(75); // Output: "01:15"
|
|
347
|
+
* minutesToHoursMinutes(5); // Output: "00:05"
|
|
348
|
+
* minutesToHoursMinutes(135);// Output: "02:15"
|
|
349
|
+
*/
|
|
350
|
+
function minutesToHoursMinutes(totalMinutes) {
|
|
351
|
+
const hours = Math.floor(totalMinutes / 60);
|
|
352
|
+
const minutes = totalMinutes % 60;
|
|
353
|
+
const hoursStr = hours.toString().padStart(2, "0");
|
|
354
|
+
const minutesStr = minutes.toString().padStart(2, "0");
|
|
355
|
+
return `${hoursStr}:${minutesStr}`;
|
|
356
|
+
}
|