Repository: bcgov/business-dashboard-ui
Pull request #177: 26797-Allowing director heading if proper business type
Author: login: TVWerdal
Created: 2025-03-27T16:19:49Z | Merged: 2025-04-07T18:41:18Z

*Issue:*https://github.com/bcgov/entity/issues/26797

Making sure that you can add directors even if no exist currently. Includes update to check if it is a relevant company type, and if so the Directors section always shows.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the namex license (Apache 2.0).



Diff:
diff --git a/cypress/e2e/components/tombstone/business-details.cy.ts b/cypress/e2e/components/tombstone/business-details.cy.ts
index 32a3f4c5..fb2a4000 100644
--- a/cypress/e2e/components/tombstone/business-details.cy.ts
+++ b/cypress/e2e/components/tombstone/business-details.cy.ts
@@ -29,7 +29,7 @@ context('Business tombstone - business detail section', () => {
 
     cy.visitBusinessDashFor('businessInfo/ben/active.json')
       .get('[data-cy="business-details"]')
-      .get('[data-cy="value-email"]').trigger('mouseover')
+      .get('[data-cy="value-email"]').trigger('mouseenter')
       .get('[data-cy="change-button-email"]').click()
       .wait('@goToBusinessProfilePage')
   })
diff --git a/package.json b/package.json
index 3c31ed01..4d836c11 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
   "name": "bcros-business-dashboard",
   "private": true,
   "type": "module",
-  "version": "1.0.45",
+  "version": "1.0.46",
   "scripts": {
     "build": "nuxt generate",
     "build:local": "nuxt build",
diff --git a/src/components/bcros/businessDetails/index.vue b/src/components/bcros/businessDetails/index.vue
index 9fd2a120..3febbb35 100644
--- a/src/components/bcros/businessDetails/index.vue
+++ b/src/components/bcros/businessDetails/index.vue
@@ -123,7 +123,7 @@ watch(() => route.params.identifier as string, loadComponentData, { immediate: t
                 v-else
                 class="items-center cursor-pointer"
                 :data-cy="'value-' + info.name"
-                @mouseover="info.showChangeButton = true"
+                @mouseenter="info.showChangeButton = true"
                 @mouseleave="info.showChangeButton = false"
                 @click="goToBusinessProfilePage"
               >
diff --git a/src/lang/en.json b/src/lang/en.json
index 34aaead3..052b2c3b 100644
--- a/src/lang/en.json
+++ b/src/lang/en.json
@@ -44,6 +44,7 @@
       "moreActions": "More Actions"
     },
     "general": {
+      "add": "Add",
       "ok": "OK",
       "change": "Change",
       "dismiss": "Dismiss",
@@ -119,6 +120,9 @@
         "dissolution": "Dissolution",
         "voluntaryDissolution": "Voluntary Dissolution"
       },
+      "noDirector": {
+        "message": "There are currently no directors."
+      },
       "registrationDate": "Registration Date",
       "businessNum": "Business Number",
       "incorporationNum": "Incorporation Number",
diff --git a/src/pages/dashboard.vue b/src/pages/dashboard.vue
index f718ce5c..8efcbcd4 100644
--- a/src/pages/dashboard.vue
+++ b/src/pages/dashboard.vue
@@ -21,6 +21,16 @@ const { pendingFilings } = storeToRefs(useBcrosBusinessBootstrap())
 const toast = useToast()
 const initialDateString = ref<Date | undefined>(undefined)
 const ui = useBcrosDashboardUi()
+const BaseCompany = [
+  CorpTypeCd.BC_COMPANY,
+  CorpTypeCd.BENEFIT_COMPANY,
+  CorpTypeCd.BC_CCC,
+  CorpTypeCd.BC_ULC_COMPANY,
+  CorpTypeCd.CONTINUE_IN,
+  CorpTypeCd.BEN_CONTINUE_IN,
+  CorpTypeCd.CCC_CONTINUE_IN,
+  CorpTypeCd.ULC_CONTINUE_IN
+]
 
 const hasDirectors = computed(() => {
   if (currentParties.value?.parties && currentParties.value?.parties.length > 0) {
@@ -29,6 +39,14 @@ const hasDirectors = computed(() => {
   return false
 })
 
+const isCoopOrBaseCompany = computed(() => {
+  if (BaseCompany.includes(business.currentBusiness.legalType) ||
+    business.currentBusiness.legalType === CorpTypeCd.COOP) {
+    return true
+  }
+  return false
+})
+
 const hasPartners = computed(() => {
   if (currentParties.value?.parties && currentParties.value.parties.length > 0) {
     return containRole(RoleTypeE.PARTNER)
@@ -522,24 +540,44 @@ const coaEffectiveDate = computed(() => {
       </BcrosSection>
 
       <!-- Current Directors -->
-      <BcrosSection v-if="hasDirectors" name="directors">
+      <BcrosSection v-if="isCoopOrBaseCompany" name="directors">
         <template #header>
           <div class="flex justify-between">
             <span>
               {{ $t('title.section.currentDirectors') }}
             </span>
-            <UButton
-              v-if="!business.isDisableNonBenCorps() && !isHistorical"
-              variant="ghost"
-              icon="i-mdi-pencil"
-              :disabled="!business.isAllowed(AllowableActionE.DIRECTOR_CHANGE)"
-              :label="$t('button.general.change')"
-              data-cy="change-button"
-              @click="changePartyInfo"
-            />
+            <span v-if="hasDirectors">
+              <UButton
+                v-if="!business.isDisableNonBenCorps() && !isHistorical"
+                variant="ghost"
+                icon="i-mdi-pencil"
+                :disabled="!business.isAllowed(AllowableActionE.DIRECTOR_CHANGE)"
+                :label="$t('button.general.change')"
+                data-cy="change-button"
+                @click="changePartyInfo"
+              />
+            </span>
+            <span v-else>
+              <UButton
+                v-if="!business.isDisableNonBenCorps() && !isHistorical"
+                variant="ghost"
+                icon="i-mdi-add"
+                :disabled="!business.isAllowed(AllowableActionE.DIRECTOR_CHANGE)"
+                :label="$t('button.general.add')"
+                data-cy="change-button"
+                @click="changePartyInfo"
+              />
+            </span>
           </div>
         </template>
-        <BcrosPartyInfo name="directors" :role-type="RoleTypeE.DIRECTOR" :show-email="false" />
+        <span v-if="hasDirectors">
+          <BcrosPartyInfo name="directors" :role-type="RoleTypeE.DIRECTOR" :show-email="false" />
+        </span>
+        <span v-else>
+          <div class="bg-white rounded overflow-hidden">
+            <p class="text-sm text-gray-700 p-5"><i>{{ $t('label.business.noDirector.message') }}</i></p>
+          </div>
+        </span>
       </BcrosSection>
 
       <!-- Partners -->


Reviews:
user: login: JazzarKarim
body: Nice LGTM
![image](https://github.com/user-attachments/assets/35e8d527-8f1a-4289-b3f6-d2eaca210917)

Please don't forget to update the package version. 
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-03-27T16:44:47Z
user: login: severinbeauvais
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-27T17:21:54Z
user: login: TVWerdal
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-27T18:03:58Z
user: login: TVWerdal
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-31T15:43:03Z
user: login: severinbeauvais
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-03T16:41:03Z
user: login: severinbeauvais
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-03T17:06:21Z
user: login: TVWerdal
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-03T17:29:48Z
user: login: severinbeauvais
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-04T19:33:27Z
user: login: severinbeauvais
body: Looks great!

![image](https://github.com/user-attachments/assets/affe8fa1-55c0-4604-a51a-9a87130573f1)
(Note: icon was changed to "add" after I took this screenshot.)

Please update app version before merging.
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-04T19:35:01Z
user: login: severinbeauvais
body: Still LGTM :)

(app version)
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-07T18:05:30Z

Review comments:
diff_hunk: @@ -25,6 +25,10 @@ const ui = useBcrosDashboardUi()
 const hasDirector = computed(() => {
   if (currentParties.value?.parties && currentParties.value?.parties.length > 0) {
     return containRole(RoleTypeE.DIRECTOR)
+  } else if (business.isEntityCoop || business.isBaseCompany) {
+    // Want to make sure eligible corporations who have deleted
+    // all directors may add one back if required.
+    return true
path: src/pages/dashboard.vue
user: login: severinbeauvais
body: Do you still need the "if" condition?
created_at: 2025-03-27T17:21:54Z
author_association: CONTRIBUTOR
diff_hunk: @@ -25,6 +25,10 @@ const ui = useBcrosDashboardUi()
 const hasDirector = computed(() => {
   if (currentParties.value?.parties && currentParties.value?.parties.length > 0) {
     return containRole(RoleTypeE.DIRECTOR)
+  } else if (business.isEntityCoop || business.isBaseCompany) {
+    // Want to make sure eligible corporations who have deleted
+    // all directors may add one back if required.
+    return true
path: src/pages/dashboard.vue
user: login: TVWerdal
body: Hm, good call - I suppose it is redundant at this point. Originally I didn't know if we would get an error if we tried to get director info when there wasn't any, so I didn't know if we would need to split it out into another function or something. But that doesn't seem to be the case. I will revise this.
created_at: 2025-03-27T18:03:57Z
author_association: COLLABORATOR
diff_hunk: @@ -25,6 +25,10 @@ const ui = useBcrosDashboardUi()
 const hasDirector = computed(() => {
   if (currentParties.value?.parties && currentParties.value?.parties.length > 0) {
     return containRole(RoleTypeE.DIRECTOR)
+  } else if (business.isEntityCoop || business.isBaseCompany) {
+    // Want to make sure eligible corporations who have deleted
+    // all directors may add one back if required.
+    return true
path: src/pages/dashboard.vue
user: login: TVWerdal
body: Updated with the latest commit
created_at: 2025-03-31T15:43:03Z
author_association: COLLABORATOR
diff_hunk: @@ -25,6 +25,10 @@ const ui = useBcrosDashboardUi()
 const hasDirector = computed(() => {
   if (currentParties.value?.parties && currentParties.value?.parties.length > 0) {
     return containRole(RoleTypeE.DIRECTOR)
+  } else if (business.isEntityCoop || business.isBaseCompany) {
+    // Want to make sure eligible corporations who have deleted
+    // all directors may add one back if required.
+    return true
path: src/pages/dashboard.vue
user: login: severinbeauvais
body: But do you need lines 26-27?
created_at: 2025-04-03T16:41:03Z
author_association: CONTRIBUTOR
diff_hunk: @@ -123,7 +123,7 @@ watch(() => route.params.identifier as string, loadComponentData, { immediate: t
                 v-else
                 class="items-center cursor-pointer"
                 :data-cy="'value-' + info.name"
-                @mouseover="info.showChangeButton = true"
+                @mouseenter="info.showChangeButton = true"
path: src/components/bcros/businessDetails/index.vue
user: login: severinbeauvais
body: This works great! 🙌 
created_at: 2025-04-03T17:06:21Z
author_association: CONTRIBUTOR
diff_hunk: @@ -123,7 +123,7 @@ watch(() => route.params.identifier as string, loadComponentData, { immediate: t
                 v-else
                 class="items-center cursor-pointer"
                 :data-cy="'value-' + info.name"
-                @mouseover="info.showChangeButton = true"
+                @mouseenter="info.showChangeButton = true"
path: src/components/bcros/businessDetails/index.vue
user: login: TVWerdal
body: Oh good! - I couldn't replicate the issues after the initial change, so I was looking for a better solution but I couldn't really check if it would help. 
created_at: 2025-04-03T17:29:48Z
author_association: COLLABORATOR
diff_hunk: @@ -25,6 +25,10 @@ const ui = useBcrosDashboardUi()
 const hasDirector = computed(() => {
   if (currentParties.value?.parties && currentParties.value?.parties.length > 0) {
     return containRole(RoleTypeE.DIRECTOR)
+  } else if (business.isEntityCoop || business.isBaseCompany) {
+    // Want to make sure eligible corporations who have deleted
+    // all directors may add one back if required.
+    return true
path: src/pages/dashboard.vue
user: login: severinbeauvais
body: Looks good. Resolving.
created_at: 2025-04-04T19:33:27Z
author_association: CONTRIBUTOR

PR comments:
user: login: TVWerdal
created_at: 2025-03-27T16:20:52Z
body: /gcbrun
author_association: COLLABORATOR
user: login: bcregistry-sre
created_at: 2025-03-27T16:23:22Z
body: Temporary Url for review: https://business-dashboard-dev--pr-177-fo7bce05.web.app

Example here: https://business-dashboard-dev--pr-177-fo7bce05.web.app/BC0887692?accountid=3040
author_association: COLLABORATOR
user: login: TVWerdal
created_at: 2025-03-27T16:28:08Z
body: Example - Directors box now shows for Coops and everything included in "isBaseCompany" in the business.ts 

![image](https://github.com/user-attachments/assets/2f67bc65-33a0-4bae-ac6c-17c8ab87833c)


![image](https://github.com/user-attachments/assets/3ce407ff-83c0-45dd-af6a-356d847b36ff)

author_association: COLLABORATOR
user: login: severinbeauvais
created_at: 2025-03-27T17:20:55Z
body: Please have a look at the failing Cypress test.
author_association: CONTRIBUTOR
user: login: TVWerdal
created_at: 2025-03-27T18:05:55Z
body: > Please have a look at the failing Cypress test.

It looks like these are all passing now. Not sure why it looked like a failure earlier. Am I missing something?
author_association: COLLABORATOR
user: login: severinbeauvais
created_at: 2025-03-27T18:12:50Z
body: > > Please have a look at the failing Cypress test.
> 
> It looks like these are all passing now. Not sure why it looked like a failure earlier. Am I missing something?

Some Cypress tests are timing-sensitive and occasionally fail. We've been adding delays in some of them to make them more reliable. I don't remember which one failed this time so we can fix it next time.
author_association: CONTRIBUTOR
user: login: severinbeauvais
created_at: 2025-04-02T18:24:57Z
body: @TVWerdal Was UX team involved in the new design?

cc: @janisrogers 
author_association: CONTRIBUTOR
user: login: TVWerdal
created_at: 2025-04-02T18:27:53Z
body: Jumped back into the original ticket, it does not appear so. It would just be using the pre-existing styling. 
author_association: COLLABORATOR
user: login: severinbeauvais
created_at: 2025-04-02T19:08:43Z
body: > Jumped back into the original ticket, it does not appear so. It would just be using the pre-existing styling.

OK. FYI, Janis might want it to show something anyway, when there are no directors. Similar to the following for addresses (from old Filings UI dashboard page). Please follow up with her and create a new ticket (or do it as part of this ticket). Thanks.

![image](https://github.com/user-attachments/assets/07ba253c-2653-4b10-8ad2-ad71eb752eb3)

author_association: CONTRIBUTOR
user: login: severinbeauvais
created_at: 2025-04-03T16:41:44Z
body: /gcbrun
author_association: CONTRIBUTOR
user: login: severinbeauvais
created_at: 2025-04-03T16:43:40Z
body: > > Jumped back into the original ticket, it does not appear so. It would just be using the pre-existing styling.
> 
> OK. FYI, Janis might want it to show something anyway, when there are no directors. Similar to the following for addresses (from old Filings UI dashboard page). Please follow up with her and create a new ticket (or do it as part of this ticket). Thanks.
> 
> ![image](https://private-user-images.githubusercontent.com/10002889/429630236-07ba253c-2653-4b10-8ad2-ad71eb752eb3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDM2OTg3NjksIm5iZiI6MTc0MzY5ODQ2OSwicGF0aCI6Ii8xMDAwMjg4OS80Mjk2MzAyMzYtMDdiYTI1M2MtMjY1My00YjEwLThhZDItYWQ3MWViNzUyZWIzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNDAzVDE2NDEwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ0OGNhOGEwMDcxZTMzMzhlODdkZTg2MjJhMGIzYjY4MGRlY2VjZTdhYjE1NzUzOTliYjY3NTQ5ZjFlNzdiYzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.PZ1MKngSZtxtNHiVepvTfngzQGjA3Q4s_V452AnsC1Y)

Any traction on this?
author_association: CONTRIBUTOR
user: login: bcregistry-sre
created_at: 2025-04-03T16:44:04Z
body: Temporary Url for review: https://business-dashboard-dev--pr-177-fo7bce05.web.app
author_association: COLLABORATOR
user: login: TVWerdal
created_at: 2025-04-03T16:58:36Z
body: > > > Jumped back into the original ticket, it does not appear so. It would just be using the pre-existing styling.
> > 
> > 
> > OK. FYI, Janis might want it to show something anyway, when there are no directors. Similar to the following for addresses (from old Filings UI dashboard page). Please follow up with her and create a new ticket (or do it as part of this ticket). Thanks.
> > ![image](https://private-user-images.githubusercontent.com/10002889/429630236-07ba253c-2653-4b10-8ad2-ad71eb752eb3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDM2OTg3NjksIm5iZiI6MTc0MzY5ODQ2OSwicGF0aCI6Ii8xMDAwMjg4OS80Mjk2MzAyMzYtMDdiYTI1M2MtMjY1My00YjEwLThhZDItYWQ3MWViNzUyZWIzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA0MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNDAzVDE2NDEwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ0OGNhOGEwMDcxZTMzMzhlODdkZTg2MjJhMGIzYjY4MGRlY2VjZTdhYjE1NzUzOTliYjY3NTQ5ZjFlNzdiYzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.PZ1MKngSZtxtNHiVepvTfngzQGjA3Q4s_V452AnsC1Y)
> 
> Any traction on this?

Yes, Janis responded and requested this design: 
![image](https://github.com/user-attachments/assets/c8d505a1-e61d-4e69-a497-c62ff44f99ac)

I have updated the original ticket with this as well. I will make this update and push it for review. 
author_association: COLLABORATOR
user: login: TVWerdal
created_at: 2025-04-04T17:19:31Z
body: /gcbrun
author_association: COLLABORATOR
user: login: bcregistry-sre
created_at: 2025-04-04T17:21:58Z
body: Temporary Url for review: https://business-dashboard-dev--pr-177-fo7bce05.web.app

Test case: [BC0887692](https://business-dashboard-dev--pr-177-fo7bce05.web.app/BC0887692)
author_association: COLLABORATOR
user: login: severinbeauvais
created_at: 2025-04-04T19:36:08Z
body: I restarted the failed Cypress tests job. If it still fails, you might to fix something.
author_association: CONTRIBUTOR
user: login: severinbeauvais
created_at: 2025-04-04T19:44:00Z
body: This failed test is probably due to your changes.
![image](https://github.com/user-attachments/assets/c64d6881-6515-48a6-a537-68a7f280528c)

Maybe this one, too. Not sure.
![image](https://github.com/user-attachments/assets/a43e7ac3-61d2-4255-a43e-b187ade14b96)

author_association: CONTRIBUTOR
user: login: TVWerdal
created_at: 2025-04-04T22:53:49Z
body: /gcbrun

author_association: COLLABORATOR
user: login: bcregistry-sre
created_at: 2025-04-04T22:56:21Z
body: Temporary Url for review: https://business-dashboard-dev--pr-177-fo7bce05.web.app
author_association: COLLABORATOR
user: login: TVWerdal
created_at: 2025-04-07T16:25:25Z
body: /gcbrun
author_association: COLLABORATOR
user: login: bcregistry-sre
created_at: 2025-04-07T16:27:45Z
body: Temporary Url for review: https://business-dashboard-dev--pr-177-fo7bce05.web.app
author_association: COLLABORATOR
user: login: TVWerdal
created_at: 2025-04-07T17:28:08Z
body: The broken tests are now fixed
author_association: COLLABORATOR