@@ -2,11 +2,10 @@ import { Component, Inject, OnInit } from '@angular/core';
2
2
import { AbstractControl , FormArray , FormBuilder , FormGroup , Validators } from '@angular/forms' ;
3
3
import { Router } from '@angular/router' ;
4
4
import { RxwebValidators } from '@rxweb/reactive-form-validators' ;
5
- import { InputSwitchChangeEvent } from 'primeng/inputswitch' ;
6
5
import { forkJoin } from 'rxjs' ;
7
6
import { brandingConfig , brandingFeatureConfig , brandingKbArticles } from 'src/app/branding/branding-config' ;
8
7
import { ImportSettingsModel } from 'src/app/core/models/common/import-settings.model' ;
9
- import { IntacctCategoryDestination , ConfigurationCta , IntacctOnboardingState , IntacctUpdateEvent , Page , ProgressPhase , ToastSeverity , MappingSourceField , AppName , TrackingApp , DefaultImportFields , SageIntacctField } from 'src/app/core/models/enum/enum.model' ;
8
+ import { IntacctCategoryDestination , ConfigurationCta , IntacctOnboardingState , IntacctUpdateEvent , Page , ProgressPhase , ToastSeverity , MappingSourceField , AppName , TrackingApp , SageIntacctField , IntacctReimbursableExpensesObject , IntacctCorporateCreditCardExpensesObject } from 'src/app/core/models/enum/enum.model' ;
10
9
import { IntacctDestinationAttribute } from 'src/app/core/models/intacct/db/destination-attribute.model' ;
11
10
import { ExpenseField } from 'src/app/core/models/intacct/db/expense-field.model' ;
12
11
import { LocationEntityMapping } from 'src/app/core/models/intacct/db/location-entity-mapping.model' ;
@@ -260,7 +259,7 @@ export class IntacctImportSettingsComponent implements OnInit {
260
259
const defaultFieldData : MappingSetting = {
261
260
source_field : '' ,
262
261
destination_field : '' ,
263
- import_to_fyle : true ,
262
+ import_to_fyle : false ,
264
263
is_custom : false ,
265
264
source_placeholder : null
266
265
} ;
@@ -299,6 +298,7 @@ export class IntacctImportSettingsComponent implements OnInit {
299
298
this . customFieldControl . disable ( ) ;
300
299
this . customFieldForDependentField = false ;
301
300
} else {
301
+ this . addImportCodeField ( { checked : true } , this . customFieldControl . get ( 'destination_field' ) ?. value ) ;
302
302
this . customField = {
303
303
attribute_type : this . customFieldForm . value . attribute_type . split ( ' ' ) . join ( '_' ) . toUpperCase ( ) ,
304
304
display_name : this . customFieldForm . value . attribute_type ,
@@ -506,6 +506,9 @@ export class IntacctImportSettingsComponent implements OnInit {
506
506
507
507
// Get the 'import_to_fyle' control at the specified index and disable it
508
508
( this . importSettingsForm . get ( 'expenseFields' ) as FormArray ) . at ( index ) ?. get ( 'import_to_fyle' ) ?. disable ( ) ;
509
+ } else {
510
+ ( this . importSettingsForm . get ( 'expenseFields' ) as FormArray ) . at ( index ) ?. get ( 'import_to_fyle' ) ?. setValue ( true ) ;
511
+ this . addImportCodeField ( { checked : true } , ( this . importSettingsForm . get ( 'expenseFields' ) as FormArray ) . at ( index ) ?. get ( 'destination_field' ) ?. value ) ;
509
512
}
510
513
511
514
if ( selectedValue === 'custom_field' ) {
@@ -552,7 +555,12 @@ export class IntacctImportSettingsComponent implements OnInit {
552
555
this . fyleFields = this . fyleFields . filter ( field => ! field . is_dependent ) ;
553
556
}
554
557
555
- if ( this . importSettings . configurations . import_code_fields . length > 0 && ! this . importSettings . configurations . import_code_fields . includes ( this . intacctCategoryDestination ) && this . intacctImportCodeConfig [ this . intacctCategoryDestination ] && this . importSettings . configurations . import_categories ) {
558
+ let sourceField = this . intacctCategoryDestination ;
559
+ if ( sourceField === IntacctCategoryDestination . GL_ACCOUNT ) {
560
+ sourceField = IntacctCategoryDestination . ACCOUNT ;
561
+ }
562
+
563
+ if ( this . importSettings . configurations . import_code_fields && this . importSettings . configurations . import_code_fields . length > 0 && ! this . importSettings . configurations . import_code_fields . includes ( sourceField ) && this . intacctImportCodeConfig [ sourceField ] && this . importSettings . configurations . import_categories ) {
556
564
this . addImportCodeField ( { checked : true } , this . intacctCategoryDestination ) ;
557
565
}
558
566
@@ -634,7 +642,7 @@ export class IntacctImportSettingsComponent implements OnInit {
634
642
}
635
643
}
636
644
637
- if ( configuration . employee_field_mapping === 'EMPLOYEE' ) {
645
+ if ( configuration . reimbursable_expenses_object === IntacctReimbursableExpensesObject . EXPENSE_REPORT || configuration . corporate_credit_card_expenses_object === IntacctCorporateCreditCardExpensesObject . EXPENSE_REPORT ) {
638
646
this . intacctCategoryDestination = IntacctCategoryDestination . EXPENSE_TYPE ;
639
647
} else {
640
648
this . intacctCategoryDestination = IntacctCategoryDestination . GL_ACCOUNT ;
0 commit comments