cloud-ide-fees 0.0.12 → 0.0.13
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/fesm2022/cloud-ide-fees.mjs +81 -8
- package/fesm2022/cloud-ide-fees.mjs.map +1 -1
- package/index.d.ts +7 -3
- package/package.json +1 -1
|
@@ -7271,7 +7271,23 @@ class FeeDetailsViewerComponent {
|
|
|
7271
7271
|
itemData.feesi_description = itemData.feesi_description || 'No description available';
|
|
7272
7272
|
}
|
|
7273
7273
|
const finalAmount = (fee.fees_total_amount || fee.fees_amount || 0) - (this.discount() || fee.discount || 0);
|
|
7274
|
-
|
|
7274
|
+
// Ensure assignmentDate is a Date object
|
|
7275
|
+
let assignmentDate;
|
|
7276
|
+
try {
|
|
7277
|
+
const dateValue = this.assignmentDate();
|
|
7278
|
+
if (dateValue instanceof Date) {
|
|
7279
|
+
assignmentDate = dateValue;
|
|
7280
|
+
}
|
|
7281
|
+
else if (dateValue && typeof dateValue === 'string') {
|
|
7282
|
+
assignmentDate = new Date(dateValue);
|
|
7283
|
+
}
|
|
7284
|
+
else {
|
|
7285
|
+
assignmentDate = new Date();
|
|
7286
|
+
}
|
|
7287
|
+
}
|
|
7288
|
+
catch {
|
|
7289
|
+
assignmentDate = new Date();
|
|
7290
|
+
}
|
|
7275
7291
|
// Ensure fee data has all required fields
|
|
7276
7292
|
const feeDataWithDefaults = {
|
|
7277
7293
|
...fee,
|
|
@@ -7289,7 +7305,31 @@ class FeeDetailsViewerComponent {
|
|
|
7289
7305
|
processFeeAssignmentData(assignment) {
|
|
7290
7306
|
// Transform assignment data to fee details format
|
|
7291
7307
|
const finalAmount = assignment.feeas_final_amount || assignment.feeas_total_amount || 0;
|
|
7292
|
-
|
|
7308
|
+
// Ensure assignmentDate is a Date object
|
|
7309
|
+
let assignmentDate;
|
|
7310
|
+
try {
|
|
7311
|
+
if (assignment.feeas_assignment_date) {
|
|
7312
|
+
assignmentDate = assignment.feeas_assignment_date instanceof Date
|
|
7313
|
+
? assignment.feeas_assignment_date
|
|
7314
|
+
: new Date(assignment.feeas_assignment_date);
|
|
7315
|
+
}
|
|
7316
|
+
else {
|
|
7317
|
+
// Try to get from input signal, otherwise use current date
|
|
7318
|
+
const dateValue = this.assignmentDate();
|
|
7319
|
+
if (dateValue instanceof Date) {
|
|
7320
|
+
assignmentDate = dateValue;
|
|
7321
|
+
}
|
|
7322
|
+
else if (dateValue && typeof dateValue === 'string') {
|
|
7323
|
+
assignmentDate = new Date(dateValue);
|
|
7324
|
+
}
|
|
7325
|
+
else {
|
|
7326
|
+
assignmentDate = new Date();
|
|
7327
|
+
}
|
|
7328
|
+
}
|
|
7329
|
+
}
|
|
7330
|
+
catch {
|
|
7331
|
+
assignmentDate = new Date();
|
|
7332
|
+
}
|
|
7293
7333
|
// Create a mock item data structure from assignment
|
|
7294
7334
|
const itemData = {
|
|
7295
7335
|
feesi_item_name: assignment.feeas_fee_name,
|
|
@@ -7326,7 +7366,23 @@ class FeeDetailsViewerComponent {
|
|
|
7326
7366
|
}
|
|
7327
7367
|
processFeeItemData(item, structure) {
|
|
7328
7368
|
const finalAmount = (item.feesi_amount || 0) - (this.discount() || 0);
|
|
7329
|
-
|
|
7369
|
+
// Ensure assignmentDate is a Date object
|
|
7370
|
+
let assignmentDate;
|
|
7371
|
+
try {
|
|
7372
|
+
const dateValue = this.assignmentDate();
|
|
7373
|
+
if (dateValue instanceof Date) {
|
|
7374
|
+
assignmentDate = dateValue;
|
|
7375
|
+
}
|
|
7376
|
+
else if (dateValue && typeof dateValue === 'string') {
|
|
7377
|
+
assignmentDate = new Date(dateValue);
|
|
7378
|
+
}
|
|
7379
|
+
else {
|
|
7380
|
+
assignmentDate = new Date();
|
|
7381
|
+
}
|
|
7382
|
+
}
|
|
7383
|
+
catch {
|
|
7384
|
+
assignmentDate = new Date();
|
|
7385
|
+
}
|
|
7330
7386
|
const feeData = {
|
|
7331
7387
|
_id: item._id,
|
|
7332
7388
|
fees_structure_name: structure.fees_structure_name,
|
|
@@ -7342,7 +7398,24 @@ class FeeDetailsViewerComponent {
|
|
|
7342
7398
|
};
|
|
7343
7399
|
this.calculateAndSetFeeDetails(item, feeData, finalAmount, assignmentDate);
|
|
7344
7400
|
}
|
|
7401
|
+
/**
|
|
7402
|
+
* Helper method to ensure a value is a Date object
|
|
7403
|
+
*/
|
|
7404
|
+
ensureDate(value) {
|
|
7405
|
+
if (value instanceof Date) {
|
|
7406
|
+
return value;
|
|
7407
|
+
}
|
|
7408
|
+
if (value && typeof value === 'string') {
|
|
7409
|
+
const date = new Date(value);
|
|
7410
|
+
if (!isNaN(date.getTime())) {
|
|
7411
|
+
return date;
|
|
7412
|
+
}
|
|
7413
|
+
}
|
|
7414
|
+
return new Date();
|
|
7415
|
+
}
|
|
7345
7416
|
calculateAndSetFeeDetails(itemData, feeData, finalAmount, assignmentDate) {
|
|
7417
|
+
// Ensure assignmentDate is always a Date object
|
|
7418
|
+
const assignmentDateObj = this.ensureDate(assignmentDate);
|
|
7346
7419
|
const installmentCount = itemData.feesi_installment_count || 1;
|
|
7347
7420
|
const installmentAllowed = itemData.feesi_is_installment_allowed || false;
|
|
7348
7421
|
const daysBetweenInstallments = 30;
|
|
@@ -7361,8 +7434,8 @@ class FeeDetailsViewerComponent {
|
|
|
7361
7434
|
let daysFromPrevious = 0;
|
|
7362
7435
|
if (itemData.feesi_due_date_offset_days !== undefined && itemData.feesi_due_date_offset_days !== null) {
|
|
7363
7436
|
if (i === 1) {
|
|
7364
|
-
dueDateObj = new Date(
|
|
7365
|
-
dueDateObj.setDate(
|
|
7437
|
+
dueDateObj = new Date(assignmentDateObj);
|
|
7438
|
+
dueDateObj.setDate(assignmentDateObj.getDate() + itemData.feesi_due_date_offset_days);
|
|
7366
7439
|
daysFromAssignment = itemData.feesi_due_date_offset_days;
|
|
7367
7440
|
}
|
|
7368
7441
|
else {
|
|
@@ -7370,7 +7443,7 @@ class FeeDetailsViewerComponent {
|
|
|
7370
7443
|
dueDateObj = new Date(previousDueDate);
|
|
7371
7444
|
dueDateObj.setDate(previousDueDate.getDate() + daysBetweenInstallments);
|
|
7372
7445
|
daysFromPrevious = daysBetweenInstallments;
|
|
7373
|
-
daysFromAssignment = Math.floor((dueDateObj.getTime() -
|
|
7446
|
+
daysFromAssignment = Math.floor((dueDateObj.getTime() - assignmentDateObj.getTime()) / (1000 * 60 * 60 * 24));
|
|
7374
7447
|
}
|
|
7375
7448
|
}
|
|
7376
7449
|
if (dueDateObj) {
|
|
@@ -7392,8 +7465,8 @@ class FeeDetailsViewerComponent {
|
|
|
7392
7465
|
let dueDate = '';
|
|
7393
7466
|
let daysFromAssignment = 0;
|
|
7394
7467
|
if (itemData.feesi_due_date_offset_days !== undefined && itemData.feesi_due_date_offset_days !== null) {
|
|
7395
|
-
const dueDateObj = new Date(
|
|
7396
|
-
dueDateObj.setDate(
|
|
7468
|
+
const dueDateObj = new Date(assignmentDateObj);
|
|
7469
|
+
dueDateObj.setDate(assignmentDateObj.getDate() + itemData.feesi_due_date_offset_days);
|
|
7397
7470
|
dueDate = dueDateObj.toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' });
|
|
7398
7471
|
daysFromAssignment = itemData.feesi_due_date_offset_days;
|
|
7399
7472
|
}
|