Skip to content

Commit

Permalink
fix: assiging isProjectCategoryRestrictionsEnabled before using it (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Aniruddha-Shriwant authored Aug 28, 2024
1 parent e1c8683 commit 3c84fd5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
13 changes: 6 additions & 7 deletions src/app/fyle/add-edit-mileage/add-edit-mileage.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,12 @@ export class AddEditMileagePage implements OnInit {

this.mileageConfig$ = orgSettings$.pipe(map((orgSettings) => orgSettings.mileage));
this.isAdvancesEnabled$ = this.checkAdvanceEnabled(orgSettings$);
this.isProjectCategoryRestrictionsEnabled$ = orgSettings$.pipe(
map(
(orgSettings) =>
orgSettings.advanced_projects?.allowed && orgSettings.advanced_projects.enable_category_restriction
)
);

this.checkNewReportsFlow(orgSettings$);

Expand Down Expand Up @@ -1661,13 +1667,6 @@ export class AddEditMileagePage implements OnInit {

this.isProjectsEnabled$ = orgSettings$.pipe(map((orgSettings) => !!orgSettings.projects?.enabled));

this.isProjectCategoryRestrictionsEnabled$ = orgSettings$.pipe(
map(
(orgSettings) =>
orgSettings.advanced_projects?.allowed && orgSettings.advanced_projects.enable_category_restriction
)
);

this.customInputs$ = this.getCustomInputs();

this.isCostCentersEnabled$ = orgSettings$.pipe(map((orgSettings) => orgSettings.cost_centers.enabled));
Expand Down
14 changes: 7 additions & 7 deletions src/app/fyle/add-edit-per-diem/add-edit-per-diem.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,13 @@ export class AddEditPerDiemPage implements OnInit {
)
);

this.isProjectCategoryRestrictionsEnabled$ = orgSettings$.pipe(
map(
(orgSettings) =>
orgSettings.advanced_projects.allowed && orgSettings.advanced_projects.enable_category_restriction
)
);

this.individualPerDiemRatesEnabled$ = orgSettings$.pipe(
map((orgSettings) => orgSettings.per_diem.enable_individual_per_diem_rates)
);
Expand Down Expand Up @@ -1126,13 +1133,6 @@ export class AddEditPerDiemPage implements OnInit {
map((orgSettings) => orgSettings.projects && orgSettings.projects.enabled)
);

this.isProjectCategoryRestrictionsEnabled$ = orgSettings$.pipe(
map(
(orgSettings) =>
orgSettings.advanced_projects.allowed && orgSettings.advanced_projects.enable_category_restriction
)
);

this.customInputs$ = this.getCustomInputs();

this.isCostCentersEnabled$ = orgSettings$.pipe(map((orgSettings) => orgSettings.cost_centers.enabled));
Expand Down

0 comments on commit 3c84fd5

Please sign in to comment.