Skip to content

Commit

Permalink
feat(fe:FSADT1-1593): CLIENT_VIEWER Client Locations Section - Front-…
Browse files Browse the repository at this point in the history
…End (#1358)

* add location interface

* add locations details

* display locations count

* add tag deactivated

* add location subtitle

* province code/desc

* add tertiary phone

* update html IDs

* update stubs locations

* pluralize word based on count number

* test: display locations information

* test: display location details

* test: switch tabs

* fix test to check attribute open

* test: apply non-isolated tests approach to some tests

* move Delivery information to the top

* rename Tertiary phone number to Other

* rename Note to Notes

* add links to email address and phone numbers

* add css style

* fix css style for email and phone numbers

* country code/desc

* sort locations

* rename Other phone back to Tertiary

* move Delivery information into the Address section

---------

Co-authored-by: Paulo Gomes da Cruz Junior <[email protected]>
  • Loading branch information
fterra-encora and paulushcgcj authored Dec 17, 2024
1 parent 8662c92 commit 08a8b96
Show file tree
Hide file tree
Showing 17 changed files with 712 additions and 97 deletions.
100 changes: 95 additions & 5 deletions frontend/cypress/e2e/pages/ClientDetailsPage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
describe("Client Details Page", () => {
beforeEach(() => {
cy.visit("/");
cy.location().then((location) => {
if (location.pathname === "blank") {
cy.visit("/");

cy.login("[email protected]", "Uat Test", "idir", {
given_name: "James",
family_name: "Baxter",
"cognito:groups": ["CLIENT_VIEWER"],
cy.login("[email protected]", "Uat Test", "idir", {
given_name: "James",
family_name: "Baxter",
"cognito:groups": ["CLIENT_VIEWER"],
});
}
});
});

Expand Down Expand Up @@ -87,4 +91,90 @@ describe("Client Details Page", () => {
});
});
});

describe("locations tab", () => {
describe("non-user action tests", { testIsolation: false }, () => {
describe("3 active locations", () => {
before(() => {
cy.visit("/clients/details/g");
});
it("displays the number of locations", () => {
cy.get("#panel-locations").contains("03 locations");
});

it("displays one collapsed accordion component for each location", () => {
cy.get("#panel-locations").within(() => {
// There are 3 accordions
cy.get("cds-accordion").should("have.length", 3);

// All accordions are initially collapsed
cy.get("cds-accordion cds-accordion-item").each(($el) => {
expect($el).not.to.have.attr("open");
});
});
});

it("displays the location name on the accordion's title", () => {
cy.get("#location-00 [slot='title']").contains("Mailing address");
cy.get("#location-01 [slot='title']").contains("Accountant's address");
cy.get("#location-02 [slot='title']").contains("Warehouse");
});

it("displays the address on the accordion's title while it's collapsed", () => {
cy.get("#location-00-title-address").should("be.visible");
cy.get("#location-01-title-address").should("be.visible");
cy.get("#location-02-title-address").should("be.visible");
});
});

describe("2 locations - 1 deactivated and 1 active", () => {
before(() => {
cy.visit("/clients/details/gd");
});
it("displays the tag Deactivated when location is expired", () => {
cy.get("cds-tag#location-00-deactivated").contains("Deactivated");
});

it("doesn't display the tag Deactivated when location is not expired", () => {
cy.get("cds-tag#location-01-deactivated").should("not.exist");
});
});
});

it("hides the address on the accordion's title when it's expanded", () => {
cy.visit("/clients/details/g");

// Clicks to expand the accordion
cy.get("#location-00 [slot='title']").click();

cy.get("#location-00-title-address").should("not.be.visible");
});

it("keeps accordions' states while tabs are switched", () => {
cy.visit("/clients/details/g");

// Expand first and third locations, leave second one collapsed
cy.get("#location-00 [slot='title']").click();
cy.get("#location-02 [slot='title']").click();

// Switch to tab another tab (Contacts)
cy.get("#tab-contacts").click();

// Make sure the current tab panel was effectively switched
cy.get("#panel-locations").should("have.attr", "hidden");
cy.get("#panel-contacts").should("not.have.attr", "hidden");

// Switch back to tab Locations
cy.get("#tab-locations").click();

// First location is still open
cy.get("#location-00 cds-accordion-item").should("have.attr", "open");

// Second location is still closed
cy.get("#location-01 cds-accordion-item").should("not.have.attr", "open");

// Third location is still open
cy.get("#location-02 cds-accordion-item").should("have.attr", "open");
});
});
});
61 changes: 56 additions & 5 deletions frontend/src/assets/styles/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ cds-actionable-notification * {
display: flex;
flex-direction: column;
padding: 1rem;
gap: 2.5rem;
gap: 1rem;
border-radius: 0.5rem;
border: 1px solid var(--light-theme-border-border-subtle-00, #dfdfe1);
background: #fff;
Expand Down Expand Up @@ -1124,6 +1124,18 @@ cds-actionable-notification * {
margin: 0.5rem 0;
}

.flex-column-1_5rem {
display: flex;
flex-direction: column;
gap: 1.5rem;
}

.flex-column-0_25rem {
display: flex;
flex-direction: column;
gap: 0.25rem;
}

.horizontal-input-grouping {
display: flex;
flex-direction: row;
Expand Down Expand Up @@ -1221,6 +1233,9 @@ cds-text-input::part(label) {
.label-with-icon {
display: flex;
gap: 0.5rem;
}

.line-height-0 {
line-height: 0; // prevents the label from being pushed away from its input field (below it).
}

Expand Down Expand Up @@ -1441,6 +1456,7 @@ cds-side-nav {
.client-details-screen {
padding-left: 0;
padding-right: 0;
padding-bottom: 0;
gap: 0;
}

Expand All @@ -1456,8 +1472,8 @@ cds-accordion-item[open]:not([disabled])::part(content),
:host(cds-accordion-item[open]:not([disabled]))
.cds-ce--accordion__content--md {
padding-right: 1rem !important;
padding-top: 0rem;
padding-bottom: inherit;
padding-top: 0;
padding-bottom: 0;
display: flex;
flex-direction: column;
gap: 2rem;
Expand Down Expand Up @@ -1604,10 +1620,30 @@ cds-header-panel[expanded] {
background: var(--light-theme-layer-layer-02, #fff);
}

.margin-left-1_75rem {
margin-left: 1.75rem;
}

.no-padding {
padding: 0;
}

.padding-left-1rem {
padding-left: 1rem;
}

.padding-left-1_625rem {
padding-left: 1.625rem;
}

.colorless {
color: unset;
}

cds-accordion-item[open] .hide-open {
display: none;
}

// Copied from .cds--side-nav__overlay-active in @carbon/styles/css/styles.css so to make it available on all breakpoints
.overlay-active {
z-index: 6000;
Expand Down Expand Up @@ -1760,10 +1796,19 @@ div.internal-grouping-01:has(svg.warning) span.body-compact-01:not(.default-typo
}

.tab-panel {
display: flex;
padding: 2.5rem;
gap: 2rem;
background: var(--light-theme-layer-layer-01, #f3f3f5);

& > div {
display: flex;
flex-direction: column;
gap: 2rem;
width: 100%;

&[hidden] {
display: none;
}
}
}

/* Small (up to 671px) */
Expand Down Expand Up @@ -1935,6 +1980,7 @@ div.internal-grouping-01:has(svg.warning) span.body-compact-01:not(.default-typo
.client-details-screen {
padding-left: 0;
padding-right: 0;
padding-bottom: 0;
}

.client-details-content {
Expand Down Expand Up @@ -2079,6 +2125,7 @@ div.internal-grouping-01:has(svg.warning) span.body-compact-01:not(.default-typo
.client-details-screen {
padding-left: 0;
padding-right: 0;
padding-bottom: 0;
}

.client-details-content {
Expand Down Expand Up @@ -2162,6 +2209,7 @@ div.internal-grouping-01:has(svg.warning) span.body-compact-01:not(.default-typo
.client-details-screen {
--padding-right: 0;
--padding-left: 16rem;
padding-bottom: 0;
}
.client-details-content {
padding-top: 0;
Expand Down Expand Up @@ -2252,6 +2300,7 @@ div.internal-grouping-01:has(svg.warning) span.body-compact-01:not(.default-typo
.client-details-screen {
--padding-right: 0;
--padding-left: 16rem;
padding-bottom: 0;
}

.client-details-content {
Expand Down Expand Up @@ -2324,6 +2373,7 @@ div.internal-grouping-01:has(svg.warning) span.body-compact-01:not(.default-typo
.client-details-screen {
--padding-right: 0;
--padding-left: 16rem;
padding-bottom: 0;
}

.client-details-content {
Expand Down Expand Up @@ -2380,6 +2430,7 @@ div.internal-grouping-01:has(svg.warning) span.body-compact-01:not(.default-typo
.client-details-screen {
--padding-right: 0;
--padding-left: 16rem;
padding-bottom: 0;
}

.client-details-content {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ const getLocationDescription = (address: Address, index: number): string =>
@empty="validation.notes = true"
@error="validation.notes = !$event"
>
<div slot="label-text" class="label-with-icon">
<div slot="label-text" class="label-with-icon line-height-0">
<div class="cds-text-input-label">
<span>Notes</span>
</div>
Expand Down
25 changes: 25 additions & 0 deletions frontend/src/dto/CommonTypesDto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,30 @@ export interface ClientDoingBusinessAs {
doingBusinessAsName: string;
}

export interface ClientLocation {
clientNumber: string;
clientLocnCode: string;
clientLocnName: string;
addressOne: string;
addressTwo: string;
addressThree: string;
city: string;
provinceCode: string;
provinceDesc: string;
postalCode: string;
countryCode: string;
countryDesc: string;
businessPhone: string;
homePhone: string;
cellPhone: string;
faxNumber: string;
emailAddress: string;
locnExpiredInd: string;
returnedMailDate: string;
trustLocationInd: string;
cliLocnComment: string;
}

export interface ClientDetails {
clientNumber: string;
clientName: string;
Expand All @@ -277,4 +301,5 @@ export interface ClientDetails {
goodStandingInd: string;
birthdate: string;
doingBusinessAs: ClientDoingBusinessAs[];
addresses: ClientLocation[];
}
Loading

0 comments on commit 08a8b96

Please sign in to comment.