@@ -2,7 +2,7 @@ import { FormControl, FormGroup } from "@angular/forms";
22import { SelectFormOption } from "../../common/select-form-option.model" ;
33import { DefaultDestinationAttribute , DestinationAttribute } from "../../db/destination-attribute.model" ;
44import { ExpenseGroupSettingGet , ExpenseGroupSettingPost } from "../../db/expense-group-setting.model" ;
5- import { AutoMapEmployeeOptions , ExpenseGroupingFieldOption , ExpenseState , ExportDateType , XeroCCCExpenseState , XeroCorporateCreditCardExpensesObject , XeroReimbursableExpensesObject } from "../../enum/enum.model" ;
5+ import { AutoMapEmployeeOptions , ExpenseGroupingFieldOption , ExpenseState , ExportDateType , SplitExpenseGrouping , XeroCCCExpenseState , XeroCorporateCreditCardExpensesObject , XeroReimbursableExpensesObject } from "../../enum/enum.model" ;
66import { ExportModuleRule , ExportSettingModel , ExportSettingValidatorRule } from "../../common/export-settings.model" ;
77import { brandingContent } from "src/app/branding/branding-config" ;
88
@@ -12,7 +12,8 @@ export type XeroExpenseGroupSettingPost = {
1212 reimbursable_export_date_type : ExportDateType | null ;
1313 corporate_credit_card_expense_group_fields ?: string [ ] | null ;
1414 ccc_export_date_type : ExportDateType | null ;
15- reimbursable_expense_state : ExpenseState
15+ reimbursable_expense_state : ExpenseState ;
16+ split_expense_grouping : SplitExpenseGrouping
1617} ;
1718
1819export interface XeroExpenseGroupSettingGet extends XeroExpenseGroupSettingPost { }
@@ -167,10 +168,23 @@ export class XeroExportSettingModel {
167168 ] ;
168169 }
169170
171+ static getSplitExpenseGroupingOptions ( ) {
172+ return [
173+ {
174+ label : 'Single Line Item' ,
175+ value : SplitExpenseGrouping . SINGLE_LINE_ITEM
176+ } ,
177+ {
178+ label : 'Multiple Line Item' ,
179+ value : SplitExpenseGrouping . MULTIPLE_LINE_ITEM
180+ }
181+ ] ;
182+ }
183+
170184 static getValidators ( ) : [ ExportSettingValidatorRule , ExportModuleRule [ ] ] {
171185 const exportSettingValidatorRule : ExportSettingValidatorRule = {
172186 reimbursableExpense : [ 'reimbursableExportType' , 'reimbursableExportGroup' , 'reimbursableExportDate' , 'expenseState' ] ,
173- creditCardExpense : [ 'creditCardExportType' , 'creditCardExportGroup' , 'creditCardExportDate' , 'cccExpenseState' , 'bankAccount' ]
187+ creditCardExpense : [ 'creditCardExportType' , 'creditCardExportGroup' , 'creditCardExportDate' , 'cccExpenseState' , 'bankAccount' , 'splitExpenseGrouping' ]
174188 } ;
175189
176190 const exportModuleRule : ExportModuleRule [ ] = [
@@ -204,7 +218,8 @@ export class XeroExportSettingModel {
204218 creditCardExportDate : new FormControl ( exportSettings ?. expense_group_settings ?. ccc_export_date_type ) ,
205219 bankAccount : new FormControl ( exportSettings ?. general_mappings ?. bank_account ?. id ? findObjectByDestinationId ( destinationAttribute , exportSettings . general_mappings . bank_account . id ) : null ) ,
206220 autoMapEmployees : new FormControl ( exportSettings ?. workspace_general_settings ?. auto_map_employees ) ,
207- searchOption : new FormControl ( '' )
221+ searchOption : new FormControl ( '' ) ,
222+ splitExpenseGrouping : new FormControl ( exportSettings ?. expense_group_settings ?. split_expense_grouping )
208223 } ) ;
209224 }
210225
@@ -215,7 +230,8 @@ export class XeroExportSettingModel {
215230 reimbursable_expense_state : exportSettingsForm . get ( 'expenseState' ) ?. value ,
216231 reimbursable_export_date_type : exportSettingsForm . get ( 'reimbursableExportDate' ) ?. value ? exportSettingsForm . get ( 'reimbursableExportDate' ) ?. value : ExportDateType . CURRENT_DATE ,
217232 ccc_expense_state : exportSettingsForm . get ( 'cccExpenseState' ) ?. value ,
218- ccc_export_date_type : exportSettingsForm . get ( 'creditCardExportDate' ) ?. value ? exportSettingsForm . get ( 'creditCardExportDate' ) ?. value : ExportDateType . SPENT_AT
233+ ccc_export_date_type : exportSettingsForm . get ( 'creditCardExportDate' ) ?. value ? exportSettingsForm . get ( 'creditCardExportDate' ) ?. value : ExportDateType . SPENT_AT ,
234+ split_expense_grouping : exportSettingsForm . get ( 'splitExpenseGrouping' ) ?. value ? exportSettingsForm . get ( 'splitExpenseGrouping' ) ?. value : SplitExpenseGrouping . MULTIPLE_LINE_ITEM
219235 } ,
220236 workspace_general_settings : {
221237 reimbursable_expenses_object : exportSettingsForm . get ( 'reimbursableExpense' ) ?. value ? XeroReimbursableExpensesObject . PURCHASE_BILL : null ,
0 commit comments