Skip to content

Commit

Permalink
Merge branch 'master' into FYLE-86cxam1w4
Browse files Browse the repository at this point in the history
  • Loading branch information
Sishhhh authored Dec 13, 2024
2 parents 87d2e82 + 5e0cc02 commit eea3990
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
android:fillType="evenOdd"/>
<path
android:pathData="M29.629,4.657V7.149H33.45V9.688H29.629V16.883H27V4.657C27,3.199 28.217,2 29.75,2H34.473V4.563H29.75C29.677,4.539 29.629,4.586 29.629,4.657Z"
android:fillColor="#F3F5F7"
android:fillColor="#000000"
android:fillType="evenOdd"/>
<path
android:pathData="M44.744,22H37.637V19.437H44.744C44.793,19.437 44.866,19.39 44.866,19.32V17.533H38.465C36.955,17.533 35.714,16.334 35.714,14.876V6.389H38.343V14.9C38.343,14.97 38.391,15.041 38.489,15.041H44.744C44.793,15.041 44.866,14.994 44.866,14.9V6.389H47.495V19.343C47.471,20.801 46.254,22 44.744,22Z"
android:fillColor="#F3F5F7"
android:fillColor="#000000"
android:fillType="evenOdd"/>
<path
android:pathData="M52.193,2V14.226C52.193,14.296 52.242,14.367 52.314,14.367H54.651V16.906H52.314C50.805,16.906 49.564,15.707 49.564,14.249V2.024H52.193V2Z"
android:fillColor="#F3F5F7"
android:fillColor="#000000"
android:fillType="evenOdd"/>
<path
android:pathData="M67.868,12.533V8.325C67.868,6.867 66.627,5.668 65.118,5.691H58.862C57.353,5.691 56.112,6.89 56.112,8.348V14.226C56.112,15.684 57.353,16.883 58.862,16.883H67.868V14.343H58.838C58.741,14.343 58.692,14.273 58.692,14.202V12.533H67.868ZM65.264,8.325V9.994H58.716V8.325C58.716,8.23 58.789,8.183 58.862,8.183H65.118C65.215,8.183 65.264,8.254 65.264,8.325Z"
android:fillColor="#F3F5F7"
android:fillColor="#000000"
android:fillType="evenOdd"/>
</group>
</vector>
1 change: 1 addition & 0 deletions capacitor.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
21 changes: 14 additions & 7 deletions src/app/auth/sign-in/error/error.component.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
<div class="error-internal">
<div class="error-internal--header" id="sign-in--error-msg">
{{ header }}
<div class="error-internal__header" id="sign-in__error-msg">
<ion-icon
class="fy-icon-close error-internal__close-icon"
[src]="'/assets/svg/cross.svg'"
(click)="closePopover()"
></ion-icon>
<div class="error-internal__header__header-text">
{{ header }}
</div>
</div>
<div *ngIf="error" class="error-internal--details">
<div *ngIf="error" class="error-internal__details">
<div *ngIf="error.status === 401 && (error.data || error.message)">
This email address will be temporarily locked after 5 unsuccessful login attempts. Try
<a class="error-internal--redirect" (click)="routeTo(['/', 'auth', 'reset_password'])">resetting</a> your
This email address will be temporarily locked after 5 unsuccessful login attempts. Would you like to try
<a class="error-internal__redirect" (click)="routeTo(['/', 'auth', 'reset_password'])">resetting</a> your
password?
</div>

Expand All @@ -31,7 +38,7 @@
<div>Your organization has restricted Fyle access to its corporate network.</div>
</div>
</div>
<div class="error-internal--primary-cta">
<button mat-flat-button color="primary" (click)="tryAgainClicked()">TRY AGAIN</button>
<div class="error-internal__primary-cta">
<ion-button class="btn-primary" fill="clear" (click)="closePopover()">Try again</ion-button>
</div>
</div>
42 changes: 26 additions & 16 deletions src/app/auth/sign-in/error/error.component.scss
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
$details-color: #ababab;
@import '../../../../theme/colors.scss';

.error-internal {
&--header {
&__header {
font-size: 20px;
padding: 16px;
font-weight: 700;
}

&--details {
font-size: 16px;
padding: 0 16px;
font-weight: 500;
color: $details-color;
}
display: flex;
flex-direction: row;
border-bottom: 1px solid $grey-lighter;
gap: 12px;

&--primary-cta {
padding: 16px;
.mat-button-base {
&__header-text {
align-items: center;
justify-content: center;
width: 100%;
font-weight: 700;
min-height: 47px;
display: flex;
flex-direction: row;
}
}

&--redirect {
&__close-icon {
align-self: flex-start;
}

&__primary-cta {
padding: 0 16px 16px;
}

&__details {
font-size: 16px;
padding: 20px 16px;
color: $black;
}

&__redirect {
text-decoration: none;
}
}
20 changes: 10 additions & 10 deletions src/app/auth/sign-in/error/error.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ describe('ErrorComponent', () => {
});

it('should have a default header', () => {
expect(component.header).toEqual('Account does not Exist');
expect(component.header).toEqual('Account does not exist');
});

it('tryAgainClicked(): should dismiss the popover on try again button click', async () => {
const tryAgainBtn = getElementBySelector(fixture, '.error-internal--primary-cta button') as HTMLButtonElement;
it('closePopover(): should dismiss the popover on try again button click', async () => {
const tryAgainBtn = getElementBySelector(fixture, '.error-internal__primary-cta ion-button') as HTMLButtonElement;
click(tryAgainBtn);
fixture.detectChanges();
await fixture.whenStable();
Expand All @@ -59,18 +59,18 @@ describe('ErrorComponent', () => {
it('should display the correct error message for status 401 and data is present', () => {
component.error = { status: 401, data: { message: 'Invalid email or password' } };
fixture.detectChanges();
const errorMessage = getElementBySelector(fixture, '.error-internal--details');
const resetLink = getElementBySelector(fixture, '.error-internal--redirect');
const errorMessage = getElementBySelector(fixture, '.error-internal__details');
const resetLink = getElementBySelector(fixture, '.error-internal__redirect');
expect(getTextContent(errorMessage)).toContain(
'This email address will be temporarily locked after 5 unsuccessful login attempts. Try resetting your password?'
'This email address will be temporarily locked after 5 unsuccessful login attempts. Would you like to try resetting your password?'
);
expect(resetLink).toBeTruthy();
});

it('should display the correct error message for status 400', () => {
component.error = { status: 400 };
fixture.detectChanges();
const errorMessage = getElementBySelector(fixture, '.error-internal--details');
const errorMessage = getElementBySelector(fixture, '.error-internal__details');
expect(getTextContent(errorMessage)).toContain(
'Your account is not verified. Please request a verification link, if required'
);
Expand All @@ -79,7 +79,7 @@ describe('ErrorComponent', () => {
it('should display the correct error message for status 500', () => {
component.error = { status: 500 };
fixture.detectChanges();
const errorMessage = getElementBySelector(fixture, '.error-internal--details');
const errorMessage = getElementBySelector(fixture, '.error-internal__details');
const supportLink = getElementBySelector(fixture, 'a');
expect(getTextContent(errorMessage)).toContain(
'Please retry in a while. Send us a note to [email protected] if the problem persists.'
Expand All @@ -90,7 +90,7 @@ describe('ErrorComponent', () => {
it('should display the correct error message for status 433', () => {
component.error = { status: 433 };
fixture.detectChanges();
const errorMessage = getElementBySelector(fixture, '.error-internal--details');
const errorMessage = getElementBySelector(fixture, '.error-internal__details');
expect(getTextContent(errorMessage)).toContain(
'This email address is locked temporarily, as there are too many unsuccessful login attempts recently. Please retry later.'
);
Expand All @@ -99,7 +99,7 @@ describe('ErrorComponent', () => {
it('should display the correct error message for status 401 and no data or message is present', () => {
component.error = { status: 401 };
fixture.detectChanges();
const errorMessage = getElementBySelector(fixture, '.error-internal--details');
const errorMessage = getElementBySelector(fixture, '.error-internal__details');
expect(getTextContent(errorMessage)).toContain(
'Your organization has restricted Fyle access to its corporate network.'
);
Expand Down
13 changes: 5 additions & 8 deletions src/app/auth/sign-in/error/error.component.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
import { Component, Input, OnInit } from '@angular/core';
import { Component, Input } from '@angular/core';
import { PopoverController } from '@ionic/angular';
import { Router } from '@angular/router';
import { HttpErrorResponse } from '@angular/common/http';

@Component({
selector: 'app-error',
templateUrl: './error.component.html',
styleUrls: ['./error.component.scss'],
})
export class ErrorComponent implements OnInit {
@Input() header = 'Account does not Exist';
export class ErrorComponent {
@Input() header = 'Account does not exist';

@Input() error;

constructor(private popoverController: PopoverController, private router: Router) {}

ngOnInit() {}

async tryAgainClicked() {
async closePopover(): Promise<void> {
await this.popoverController.dismiss();
}

async routeTo(route: string[]) {
async routeTo(route: string[]): Promise<void> {
this.router.navigate(route);
await this.popoverController.dismiss();
}
Expand Down
3 changes: 1 addition & 2 deletions src/app/auth/sign-in/sign-in.page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ describe('SignInPage', () => {
fixture.detectChanges();
const emailError = fixture.debugElement.query(By.css('.sign-in__enter-email__error-message'));
expect(emailError).toBeDefined();
console.log(emailError);
expect(getTextContent(emailError.nativeElement)).toEqual('Please enter a valid email.');
});
});
Expand Down Expand Up @@ -305,7 +304,7 @@ describe('SignInPage', () => {
const errorPopoverSpy = jasmine.createSpyObj('errorPopover', ['present']);
popoverController.create.and.returnValue(errorPopoverSpy);

const header = 'Incorrect Email or Password';
const header = 'Incorrect email or password';

await component.handleError(null);

Expand Down
2 changes: 1 addition & 1 deletion src/app/auth/sign-in/sign-in.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class SignInPage implements OnInit {
}

async handleError(error: HttpErrorResponse): Promise<void> {
let header = 'Incorrect Email or Password';
let header = 'Incorrect email or password';

if (error?.status === 400) {
this.router.navigate(['/', 'auth', 'pending_verification', { email: this.fg.controls.email.value as string }]);
Expand Down
9 changes: 7 additions & 2 deletions src/app/core/services/transaction.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ export class TransactionService {
orig_currency: expense.foreign_currency,
from_dt: expense.started_at,
to_dt: expense.ended_at,
tax: expense.tax_amount,
vendor: expense.merchant,
distance: expense.distance,
distance_unit: expense.distance_unit,
Expand Down Expand Up @@ -767,11 +768,15 @@ export class TransactionService {
tx_file_ids: expense.file_ids,
tx_creator_id: expense.employee?.id,
tx_state: expense.state,
tx_tax_org_id: expense.tax_group_id,
tx_org_category_id: expense.category_id,
tx_from_dt: expense.started_at,
tx_to_dt: expense.ended_at,
tx_tax_group_id: expense.tax_group_id,
tx_tax: expense.tax_amount,
tg_name: expense.tax_group?.name,
tx_project_name: expense.project?.name,
tx_project_id: expense.project_id,
tx_cost_center_name: expense.cost_center?.name,
tx_cost_center_name: expense.cost_center?.name || null,
tx_cost_center_id: expense.cost_center_id,
tx_corporate_credit_card_expense_group_id:
expense.matched_corporate_card_transaction_ids?.length > 0
Expand Down
3 changes: 3 additions & 0 deletions src/app/fyle/merge-expense/merge-expense.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@ export class MergeExpensePage implements OnInit, AfterViewChecked {
}

onReceiptChanged(receipt_ids: string): void {
if (!receipt_ids) {
return;
}
this.mergeExpensesService.getAttachements(receipt_ids).subscribe((receipts) => {
this.selectedReceiptsId = receipts.map((receipt) => receipt.id);
this.attachments = receipts;
Expand Down
3 changes: 2 additions & 1 deletion src/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ ion-popover.dialog-popover {
left: 0 !important;
height: auto;
width: 100%;
border-radius: 0;
border-top-left-radius: 20px;
border-top-right-radius: 20px;
}

.popover-viewport {
Expand Down

0 comments on commit eea3990

Please sign in to comment.