cloud-ide-fees 0.0.20 → 0.0.21

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.
@@ -961,6 +961,14 @@ class FeeStructureCreateComponent {
961
961
  }
962
962
  // Note: Program/Section selector component handles all class program, branch, term, and section loading automatically
963
963
  // No need for manual listeners - the component reacts to form changes internally
964
+ // Watch for term value changes to ensure it's captured (especially for one-to-one mappings)
965
+ this.feeStructureForm.get('fees_class_program_term_id_acapt')?.valueChanges
966
+ .pipe(takeUntilDestroyed(this.destroyRef))
967
+ .subscribe(termId => {
968
+ if (termId) {
969
+ console.log('✅ Term value set in form:', termId);
970
+ }
971
+ });
964
972
  // Watch for changes in fee items array to update total amount
965
973
  this.feeItemsArray.valueChanges
966
974
  .pipe(takeUntilDestroyed(this.destroyRef))
@@ -2076,8 +2084,15 @@ class FeeStructureCreateComponent {
2076
2084
  return;
2077
2085
  }
2078
2086
  this.submitting.set(true);
2087
+ // Ensure term control is enabled so it's included in getRawValue()
2088
+ const termControl = this.feeStructureForm.get('fees_class_program_term_id_acapt');
2089
+ if (termControl?.disabled) {
2090
+ termControl.enable({ emitEvent: false });
2091
+ }
2079
2092
  // Get form value, including disabled controls
2080
2093
  const formValue = this.feeStructureForm.getRawValue();
2094
+ // Get term value - check both formValue and control directly (for one-to-one mappings where term is auto-selected)
2095
+ const termId = formValue.fees_class_program_term_id_acapt || termControl?.value || undefined;
2081
2096
  // Build fee structure object
2082
2097
  const feeStructure = {
2083
2098
  _id: this.isEditMode() ? this.feeStructureId() : undefined,
@@ -2088,11 +2103,21 @@ class FeeStructureCreateComponent {
2088
2103
  fees_entity_id_syen: formValue.fees_entity_id_syen,
2089
2104
  fees_class_program_id_acacpm: formValue.fees_class_program_id_acacpm || undefined,
2090
2105
  fees_class_program_branch_id_acabrn: formValue.fees_class_program_branch_id_acabrn || undefined,
2091
- fees_class_program_term_id_acapt: formValue.fees_class_program_term_id_acapt || undefined,
2106
+ fees_class_program_term_id_acapt: termId || undefined,
2092
2107
  fees_program_term_section_id_acapts: formValue.fees_program_term_section_id_acapts || undefined,
2093
2108
  fees_student_category_id_sygms: formValue.fees_student_category_id_sygms || undefined,
2094
2109
  fees_is_active: formValue.fees_is_active ?? true
2095
2110
  };
2111
+ // Debug log to verify term is included
2112
+ if (formValue.fees_class_program_id_acacpm && !feeStructure.fees_class_program_term_id_acapt) {
2113
+ console.warn('⚠️ Warning: Class program selected but term ID is missing from fee structure payload');
2114
+ console.warn('Form value term:', formValue.fees_class_program_term_id_acapt);
2115
+ console.warn('Control value term:', termControl?.value);
2116
+ console.warn('Control disabled:', termControl?.disabled);
2117
+ }
2118
+ else if (feeStructure.fees_class_program_term_id_acapt) {
2119
+ console.log('✅ Term ID included in fee structure:', feeStructure.fees_class_program_term_id_acapt);
2120
+ }
2096
2121
  // Build fee structure items array
2097
2122
  const feeStructureItems = this.feeItemsArray.controls.map((itemControl, index) => {
2098
2123
  const itemValue = itemControl.getRawValue();