diff --git a/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.html b/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.html index 32f29025c..f1bae3ec1 100644 --- a/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.html +++ b/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.html @@ -14,25 +14,24 @@ Visibility - - + + {{ customer.id }} {{ customer.name }} - + @@ -62,5 +61,5 @@ [title]="'Edit Customer'" [body]="message" (closeModalEvent)="closeModal()" - > +> diff --git a/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.spec.ts b/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.spec.ts index 9a3cd4957..c51cdef95 100644 --- a/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.spec.ts +++ b/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.spec.ts @@ -84,7 +84,7 @@ describe('CustomerTableListComponent', () => { it('Onclick Edit, if there are changes, the modal must be presented ', () => { component.hasChange = true; - const expectMessage = 'Do you have changes in a client, do you want to discard them?'; + const expectMessage = 'You have changes in a client, do you want to discard them?'; component.editCustomer('1'); @@ -92,7 +92,7 @@ describe('CustomerTableListComponent', () => { expect(component.showModal).toBeTrue(); }); - it('onClick edit, if there are not have changes dispatch SetCustomerToEdit, enable customer form and hidden modal', () => { + it('onClick edit, if there are no unsaved changes dispatch SetCustomerToEdit, enable customer form and hide modal', () => { component.hasChange = false; spyOn(store, 'dispatch'); @@ -115,7 +115,7 @@ describe('CustomerTableListComponent', () => { expect(store.dispatch).toHaveBeenCalledWith(new ResetProjectTypeToEdit()); }); - it('when you click close modal, you should close the modal, discard the current changes and load a new client for edit', () => { + it('when you click close modal, modal should close, discard the current changes and load a new client to edit', () => { spyOn(component.changeValueShowCustomerForm, 'emit'); spyOn(store, 'dispatch'); diff --git a/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.ts b/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.ts index dbb0d79af..438e2fed5 100644 --- a/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.ts +++ b/src/app/modules/customer-management/components/customer-info/components/customer-list/customer-list.component.ts @@ -19,6 +19,12 @@ import { ResetProjectToEdit, SetProjectToEdit } from '../../../projects/componen import { ResetProjectTypeToEdit, SetProjectTypeToEdit } from '../../../projects-type/store'; import { UnarchiveCustomer } from '../../../../store/customer-management.actions'; + +export function scrollToCustomerForm(): void { + const element = document.getElementById('customerForm'); + element.scrollIntoView(); +} + @Component({ selector: 'app-customer-list', templateUrl: './customer-list.component.html', @@ -117,7 +123,7 @@ export class CustomerListComponent implements OnInit, OnDestroy, AfterViewInit { editCustomer(customerId: string) { this.idToEdit = customerId; if (this.hasChange) { - this.message = 'Do you have changes in a client, do you want to discard them?'; + this.message = 'You have changes in a client, do you want to discard them?'; this.showModal = true; } else { this.showCustomerForm = true; @@ -199,4 +205,8 @@ export class CustomerListComponent implements OnInit, OnDestroy, AfterViewInit { this.store.dispatch(new UnarchiveCustomer(this.idToDelete, this.changeOppositeStatus(this.statusToEdit))); } + goToCustomerForm(){ + scrollToCustomerForm(); + } + } diff --git a/src/app/modules/customer-management/pages/customer.component.html b/src/app/modules/customer-management/pages/customer.component.html index 39c79b4e6..bb4350393 100644 --- a/src/app/modules/customer-management/pages/customer.component.html +++ b/src/app/modules/customer-management/pages/customer.component.html @@ -1,7 +1,7 @@
- +
-
-
- +
+
+
+ +
diff --git a/src/app/modules/customer-management/pages/customer.component.ts b/src/app/modules/customer-management/pages/customer.component.ts index 42ee3056c..c9795ed89 100644 --- a/src/app/modules/customer-management/pages/customer.component.ts +++ b/src/app/modules/customer-management/pages/customer.component.ts @@ -2,6 +2,8 @@ import { Store } from '@ngrx/store'; import { Customer } from 'src/app/modules/shared/models'; import { SetCustomerToEdit } from 'src/app/modules/customer-management/store'; import { Component } from '@angular/core'; +import { scrollToCustomerForm } from '../components/customer-info/components/customer-list/customer-list.component'; + @Component({ selector: 'app-customer', @@ -28,4 +30,9 @@ export class CustomerComponent { getChangesInputs(event) { this.hasChangeComponent = event; } + + goToCustomerForm(){ + scrollToCustomerForm(); + } + }