Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
refactor: TTA-189 scrollToCustomer
  • Loading branch information
mmaquina committed Nov 24, 2022
commit 2c4fce29dd62762630c9e7aa966ea108da636dbc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<td class="col-2 text-center">
<button
data-toggle="modal"
(click)="editCustomer(customer.id)"
(click)="editCustomer(customer.id); goToCustomerForm()"
type="button"
data-target="#editModal"
class="btn btn-sm btn-primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ export class CustomerListComponent implements OnInit, OnDestroy, AfterViewInit {
this.changeValueShowCustomerForm.emit(this.showCustomerForm);
this.resetProjectFieldsToEdit();
this.store.dispatch(new SetCustomerToEdit(customerId));
scrollToCustomerForm();
}
}

Expand Down Expand Up @@ -206,4 +205,8 @@ export class CustomerListComponent implements OnInit, OnDestroy, AfterViewInit {
this.store.dispatch(new UnarchiveCustomer(this.idToDelete, this.changeOppositeStatus(this.statusToEdit)));
}

goToCustomerForm(){
scrollToCustomerForm();
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="container-fluid px-0 full-height">
<div class="row">
<div style="padding: 15px;">
<button (click)="activateCustomerForm()" class="btn btn-primary">Add new customer</button>
<button (click)="activateCustomerForm(); goToCustomerForm()" class="btn btn-primary">Add new customer</button>
</div>
</div>
<app-customer-list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export class CustomerComponent {
activateCustomerForm() {
this.store.dispatch(new SetCustomerToEdit(null));
this.showCustomerForm = true;
scrollToCustomerForm();
}

closeCustomerForm(event) {
Expand All @@ -32,4 +31,8 @@ export class CustomerComponent {
this.hasChangeComponent = event;
}

goToCustomerForm(){
scrollToCustomerForm();
}

}