Repository: bcgov/lear
Pull request #3418: 27115 - Create Amalgamated Out Business Summary Output
Author: login: ArwenQin
Created: 2025-04-22T21:51:07Z | Merged: 2025-04-29T16:03:38Z

*Issue #:* /bcgov/entity#27115

*Description of changes:*
- Filing Outputs are not needed for both CAO and Amalgamation Out, so removed them from document list and email attachments.
- Add Amalgamation Out Information Section in Business Summary

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the lear license (Apache 2.0).



Diff:
diff --git a/legal-api/report-templates/businessSummary.html b/legal-api/report-templates/businessSummary.html
index 0600083450..36299bf0be 100644
--- a/legal-api/report-templates/businessSummary.html
+++ b/legal-api/report-templates/businessSummary.html
@@ -34,6 +34,7 @@
       [[business-summary/alterations.html]]
       [[business-summary/nameChanges.html]]
       [[business-summary/stateTransition.html]]
+      [[business-summary/amalgamationOut.html]]
       [[business-summary/recordKeeper.html]]
       [[business-summary/amalgamations.html]]
       [[common/addresses.html]]
diff --git a/legal-api/report-templates/consentAmalgamationOut.html b/legal-api/report-templates/consentAmalgamationOut.html
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/legal-api/report-templates/template-parts/business-summary/amalgamationOut.html b/legal-api/report-templates/template-parts/business-summary/amalgamationOut.html
new file mode 100644
index 0000000000..2bd21b8d98
--- /dev/null
+++ b/legal-api/report-templates/template-parts/business-summary/amalgamationOut.html
@@ -0,0 +1,20 @@
+{% if amalgamationOut|length > 0 %}
+<div class="no-page-break">
+  <div class="separator mt-4"></div>
+  <div class="section-title mt-4">Amalgamation Out Information</div>
+</div>
+<div class="section-data mt-2 mb-5">
+    <div class="pt-2">
+        <span class="section-sub-title">New Jurisdiction:</span>
+        <span class="section-data">{{amalgamationOut.jurisdiction}}</span>
+    </div>
+    <div class="pt-3">
+        <span class="section-sub-title">Business Name in New Jurisdiction:</span>
+        <span class="section-data">{{amalgamationOut.foreignLegalName}} </span>
+    </div>
+    <div class="pt-3">
+        <span class="section-sub-title">Amalgamation Effective Date:</span>  
+        <span class="section-data">{{amalgamationOut.amalgamationOutDate}} </span>
+    </div>
+</div>
+{% endif %}
diff --git a/legal-api/report-templates/template-parts/common/businessDetails.html b/legal-api/report-templates/template-parts/common/businessDetails.html
index 22b51d8d8e..32827cdea9 100644
--- a/legal-api/report-templates/template-parts/common/businessDetails.html
+++ b/legal-api/report-templates/template-parts/common/businessDetails.html
@@ -43,11 +43,13 @@
                  <div class="pt-2">{{report_date_time}}</div>
                  <div class="pt-2">
                      <span class="capitalize-text">{{business.state}}</span>
-                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and stateFilings %}
+                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and (stateFilings or amalgamationOut) %}
                          <span> - </span>
                          {% if business.state == 'HISTORICAL' %}
                              {% if business.legalType in ['GP', 'SP'] %}
                                  <span>Dissolved</span>
+                              {% elif amalgamationOut %}
+                                 <span>Amalgamation out on {{amalgamationOut.amalgamationOutDate}}</span>
                               {% else %}
                                  {% set filing = stateFilings[0] %}
                                  {% if filing.filingType == 'putBackOff' %}
diff --git a/legal-api/report-templates/template-parts/common/courtOrder.html b/legal-api/report-templates/template-parts/common/courtOrder.html
index 127f07e206..99767ea60e 100644
--- a/legal-api/report-templates/template-parts/common/courtOrder.html
+++ b/legal-api/report-templates/template-parts/common/courtOrder.html
@@ -5,5 +5,5 @@
       Court order(s) have been filed on this company. Review the filing history for impacts to business information.
    </div>
 </div>
-<div class="separator mt-4 mb-2"></div>
-{% endif %}
\ No newline at end of file
+<div class="separator mt-4 mb-4"></div>
+{% endif %}
diff --git a/legal-api/report-templates/template-parts/common/footerMOCS.html b/legal-api/report-templates/template-parts/common/footerMOCS.html
index c325b362dc..059308d982 100644
--- a/legal-api/report-templates/template-parts/common/footerMOCS.html
+++ b/legal-api/report-templates/template-parts/common/footerMOCS.html
@@ -2,7 +2,7 @@
       <table class="footer-mocs-table">
         <tr>
           <td class="width-50 bold">
-            <span class="footer-mocs-table-1st-col">Ministry of Citizen's Services</span>
+            <span class="footer-mocs-table-1st-col">Ministry of Citizens' Services</span>
           </td>
           <td>Mailing Address:</td>
           <td>
diff --git a/legal-api/report-templates/template-parts/common/style.html b/legal-api/report-templates/template-parts/common/style.html
index 92c3e013f3..00e53488bd 100644
--- a/legal-api/report-templates/template-parts/common/style.html
+++ b/legal-api/report-templates/template-parts/common/style.html
@@ -456,6 +456,9 @@
 	.mt-15 { margin-top: 3.75rem; }
 	.mt-16 { margin-top: 4rem; }
 
+	.mb-4 { margin-bottom: 1rem; }
+	.mb-5 { margin-bottom: 1.25rem; }
+
 	.pt-1 { padding-top: 0.25rem; }
 	.pt-2 { padding-top: 0.5rem; }
 	.pt-3 { padding-top: 0.75rem; }
diff --git a/legal-api/src/legal_api/core/filing.py b/legal-api/src/legal_api/core/filing.py
index 26b98b38d0..8b65927ceb 100644
--- a/legal-api/src/legal_api/core/filing.py
+++ b/legal-api/src/legal_api/core/filing.py
@@ -531,7 +531,9 @@ def get_document_list(business,  # pylint: disable=too-many-locals disable=too-m
             documents['documents']['receipt'] = f'{base_url}{doc_url}/receipt'
 
         no_legal_filings_in_paid_withdrawn_status = [
+            Filing.FilingTypes.AMALGAMATIONOUT.value,
             Filing.FilingTypes.REGISTRATION.value,
+            Filing.FilingTypes.CONSENTAMALGAMATIONOUT.value,
             Filing.FilingTypes.CONSENTCONTINUATIONOUT.value,
             Filing.FilingTypes.COURTORDER.value,
             Filing.FilingTypes.CONTINUATIONOUT.value,
@@ -571,6 +573,8 @@ def get_document_list(business,  # pylint: disable=too-many-locals disable=too-m
                         legal_filings_copy.remove(Filing.FilingTypes.ALTERATION.value)
 
                 no_legal_filings = [
+                    Filing.FilingTypes.AMALGAMATIONOUT.value,
+                    Filing.FilingTypes.CONSENTAMALGAMATIONOUT.value,
                     Filing.FilingTypes.CONSENTCONTINUATIONOUT.value,
                     Filing.FilingTypes.CONTINUATIONOUT.value,
                     Filing.FilingTypes.COURTORDER.value,
diff --git a/legal-api/src/legal_api/reports/business_document.py b/legal-api/src/legal_api/reports/business_document.py
index 7719bb923d..d3b7ecda4a 100644
--- a/legal-api/src/legal_api/reports/business_document.py
+++ b/legal-api/src/legal_api/reports/business_document.py
@@ -92,6 +92,7 @@ def _substitute_template_parts(template_code):
             'business-summary/liquidation',
             'business-summary/nameChanges',
             'business-summary/stateTransition',
+            'business-summary/amalgamationOut',
             'business-summary/recordKeeper',
             'business-summary/parties',
             'common/addresses',
@@ -144,6 +145,7 @@ def _get_template_data(self, get_json=False):
                 self._set_business_changes(business_json)
                 self._set_amalgamation_details(business_json)
                 self._set_amalgamating_details(business_json)
+                self._set_amalgamation_out(business_json)
                 self._set_liquidation_details(business_json)
                 self._set_continuation_in_details(business_json)
 
@@ -545,6 +547,29 @@ def _set_amalgamating_details(self, business: dict):
             # (if a business was a TED and it is now a TING). No need to show amalgamating businesses information
             business['amalgamatedEntities'] = []
 
+    def _set_amalgamation_out(self, business: dict):
+        filings = Filing.get_filings_by_types(self._business.id, ['amalgamationOut'])
+        if filings:
+            filing = filings[0]
+            filing_info = {}
+            filing_meta = filing.meta_data
+            filing_type = filing.filing_type
+            filing_info['filingName'] = BusinessDocument._get_summary_display_name(filing_type, None, None, None)
+
+            country_code = filing_meta['amalgamationOut']['country']
+            region_code = filing_meta['amalgamationOut']['region']
+
+            country = pycountry.countries.get(alpha_2=country_code)
+            region = None
+            if region_code and region_code.upper() != 'FEDERAL':
+                region = pycountry.subdivisions.get(code=f'{country_code}-{region_code}')
+            filing_info['jurisdiction'] = f'{region.name}, {country.name}' if region else country.name
+            filing_info['foreignLegalName'] = filing_meta['amalgamationOut']['legalName']
+            amalgamation_out_date = LegislationDatetime.as_legislation_timezone_from_date_str(
+                filing_meta['amalgamationOut']['amalgamationOutDate'])
+            filing_info['amalgamationOutDate'] = amalgamation_out_date.strftime(OUTPUT_DATE_FORMAT)
+            business['amalgamationOut'] = filing_info
+
     def _set_liquidation_details(self, business: dict):
         """Set partial liquidation filing data."""
         liquidation_info = {}
@@ -693,6 +718,7 @@ def _get_legal_type_description(legal_type: str) -> str:
         'putBackOff': {
             'Limited Restoration Expired': 'Dissolved due to expired Limited Restoration'
         },
+        'amalgamationOut': 'Amalgamation Out',
         'continuationOut': 'Continuation Out'
     }
 
diff --git a/legal-api/src/legal_api/reports/report.py b/legal-api/src/legal_api/reports/report.py
index e99185ae92..5d4279476a 100644
--- a/legal-api/src/legal_api/reports/report.py
+++ b/legal-api/src/legal_api/reports/report.py
@@ -1478,10 +1478,6 @@ class ReportMeta:  # pylint: disable=too-few-public-methods
                 'fileName': 'firmCorrection'
             }
         },
-        'consentAmalgamationOut': {
-            'filingDescription': '6-Month Consent to Amalgamate Out',
-            'fileName': 'consentAmalgamationOut'
-        },
         'certificateOfRestoration': {
             'filingDescription': 'Certificate of Restoration',
             'fileName': 'certificateOfRestoration'
diff --git a/queue_services/entity-emailer/src/entity_emailer/email_processors/consent_amalgamation_out_notification.py b/queue_services/entity-emailer/src/entity_emailer/email_processors/consent_amalgamation_out_notification.py
index 06b53133c8..be03a58e5e 100644
--- a/queue_services/entity-emailer/src/entity_emailer/email_processors/consent_amalgamation_out_notification.py
+++ b/queue_services/entity-emailer/src/entity_emailer/email_processors/consent_amalgamation_out_notification.py
@@ -48,20 +48,6 @@ def _get_pdfs(
         'Authorization': f'Bearer {token}'
     }
 
-    # add filing PDF
-    filing_pdf_type = 'consentAmalgamationOut'
-    filing_pdf_encoded = get_filing_document(business['identifier'], filing.id, filing_pdf_type, token)
-    if filing_pdf_encoded:
-        pdfs.append(
-            {
-                'fileName': '6-Month Consent to Amalgamate Out.pdf',
-                'fileBytes': filing_pdf_encoded.decode('utf-8'),
-                'fileUrl': '',
-                'attachOrder': str(attach_order)
-            }
-        )
-        attach_order += 1
-
     # add Letter of Consent pdf
     filing_pdf_type = 'letterOfConsentAmalgamationOut'
     filing_pdf_encoded = get_filing_document(business['identifier'], filing.id, filing_pdf_type, token)


Reviews:
user: login: ArwenQin
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-22T21:59:20Z
user: login: ArwenQin
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-22T22:01:28Z
user: login: ArwenQin
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-22T22:02:09Z
user: login: ArwenQin
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-22T22:04:44Z
user: login: ArwenQin
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-22T22:08:50Z
user: login: vysakh-menon-aot
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-22T22:33:27Z
user: login: vysakh-menon-aot
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-22T22:35:20Z
user: login: ArwenQin
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-22T22:41:15Z
user: login: severinbeauvais
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-23T17:02:49Z
user: login: ArwenQin
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-23T17:15:36Z
user: login: severinbeauvais
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-23T17:45:20Z
user: login: ArwenQin
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-23T18:03:34Z
user: login: vysakh-menon-aot
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-23T18:41:45Z
user: login: ArwenQin
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-23T18:53:04Z
user: login: severinbeauvais
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-23T18:54:01Z
user: login: ArwenQin
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-24T16:40:37Z
user: login: ArwenQin
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-28T19:23:46Z
user: login: ArwenQin
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-28T19:25:25Z
user: login: ArwenQin
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-28T19:28:08Z
user: login: vysakh-menon-aot
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-04-28T19:48:55Z
user: login: TVWerdal
body: LGTM
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-04-28T21:13:27Z

Review comments:
diff_hunk: @@ -5,5 +5,5 @@
       Court order(s) have been filed on this company. Review the filing history for impacts to business information.
    </div>
 </div>
-<div class="separator mt-4 mb-2"></div>
-{% endif %}
path: legal-api/report-templates/template-parts/common/courtOrder.html
user: login: ArwenQin
body: remove the not used mb-2 class. The mb-2 class is not in style.html
created_at: 2025-04-22T21:59:20Z
author_association: CONTRIBUTOR
diff_hunk: @@ -571,6 +573,8 @@ def get_document_list(business,  # pylint: disable=too-many-locals disable=too-m
                         legal_filings_copy.remove(Filing.FilingTypes.ALTERATION.value)
 
                 no_legal_filings = [
+                    Filing.FilingTypes.AMALGAMATIONOUT.value,
+                    Filing.FilingTypes.CONSENTAMALGAMATIONOUT.value,
                     Filing.FilingTypes.CONSENTCONTINUATIONOUT.value,
path: legal-api/src/legal_api/core/filing.py
user: login: ArwenQin
body: Filing Outputs are not needed for both CAO and Amalgamation Out
![image](https://github.com/user-attachments/assets/74af7231-f671-42b7-96af-2901dbd89622)
![image](https://github.com/user-attachments/assets/d47b612b-432f-47b9-919b-a8fcd75e50a7)

created_at: 2025-04-22T22:01:27Z
author_association: CONTRIBUTOR
diff_hunk: @@ -48,20 +48,6 @@ def _get_pdfs(
         'Authorization': f'Bearer {token}'
     }
 
-    # add filing PDF
-    filing_pdf_type = 'consentAmalgamationOut'
-    filing_pdf_encoded = get_filing_document(business['identifier'], filing.id, filing_pdf_type, token)
-    if filing_pdf_encoded:
-        pdfs.append(
-            {
-                'fileName': '6-Month Consent to Amalgamate Out.pdf',
-                'fileBytes': filing_pdf_encoded.decode('utf-8'),
-                'fileUrl': '',
-                'attachOrder': str(attach_order)
-            }
-        )
-        attach_order += 1
-
     # add Letter of Consent pdf
path: queue_services/entity-emailer/src/entity_emailer/email_processors/consent_amalgamation_out_notification.py
user: login: ArwenQin
body: don't attach the filing output in email as well
created_at: 2025-04-22T22:02:08Z
author_association: CONTRIBUTOR
diff_hunk: @@ -43,11 +43,13 @@
                  <div class="pt-2">{{report_date_time}}</div>
                  <div class="pt-2">
                      <span class="capitalize-text">{{business.state}}</span>
-                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and stateFilings %}
+                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and (stateFilings or amalgamationOut) %}
                          <span> - </span>
                          {% if business.state == 'HISTORICAL' %}
                              {% if business.legalType in ['GP', 'SP'] %}
                                  <span>Dissolved</span>
+                              {% elif amalgamationOut %}
+                                 <span>Amalgamation out on {{amalgamationOut.amalgamationOutDate}}</span>
                               {% else %}
path: legal-api/report-templates/template-parts/common/businessDetails.html
user: login: ArwenQin
body: for the status description

![image](https://github.com/user-attachments/assets/89b1bc83-4582-4831-b147-1b3c68b27a78)

created_at: 2025-04-22T22:04:44Z
author_association: CONTRIBUTOR
diff_hunk: @@ -34,6 +34,7 @@
       [[business-summary/alterations.html]]
       [[business-summary/nameChanges.html]]
       [[business-summary/stateTransition.html]]
+      [[business-summary/amalgamationOut.html]]
       [[business-summary/recordKeeper.html]]
path: legal-api/report-templates/businessSummary.html
user: login: ArwenQin
body: confirmed with Janis, it's under nameChanges->stateTransition, and above amalgamations
![image](https://github.com/user-attachments/assets/3faab575-9b1a-48fd-9fb4-2bd855bc9480)

created_at: 2025-04-22T22:08:49Z
author_association: CONTRIBUTOR
diff_hunk: @@ -43,11 +43,13 @@
                  <div class="pt-2">{{report_date_time}}</div>
                  <div class="pt-2">
                      <span class="capitalize-text">{{business.state}}</span>
-                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and stateFilings %}
+                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and (stateFilings or amalgamationOut) %}
path: legal-api/report-templates/template-parts/common/businessDetails.html
user: login: vysakh-menon-aot
body: amalgamationOut has a state change. should be included in `stateFilings`
created_at: 2025-04-22T22:33:26Z
author_association: COLLABORATOR
diff_hunk: @@ -545,6 +547,29 @@ def _set_amalgamating_details(self, business: dict):
             # (if a business was a TED and it is now a TING). No need to show amalgamating businesses information
             business['amalgamatedEntities'] = []
 
+    def _set_amalgamation_out(self, business: dict):
+        filings = Filing.get_filings_by_types(self._business.id, ['amalgamationOut'])
+        if filings:
+            filing = filings[0]
+            filing_info = {}
+            filing_meta = filing.meta_data
+            filing_type = filing.filing_type
+            filing_info['filingName'] = BusinessDocument._get_summary_display_name(filing_type, None, None, None)
+
+            country_code = filing_meta['amalgamationOut']['country']
+            region_code = filing_meta['amalgamationOut']['region']
+
+            country = pycountry.countries.get(alpha_2=country_code)
+            region = None
+            if region_code and region_code.upper() != 'FEDERAL':
+                region = pycountry.subdivisions.get(code=f'{country_code}-{region_code}')
+            filing_info['jurisdiction'] = f'{region.name}, {country.name}' if region else country.name
+            filing_info['foreignLegalName'] = filing_meta['amalgamationOut']['legalName']
+            amalgamation_out_date = LegislationDatetime.as_legislation_timezone_from_date_str(
+                filing_meta['amalgamationOut']['amalgamationOutDate'])
+            filing_info['amalgamationOutDate'] = amalgamation_out_date.strftime(OUTPUT_DATE_FORMAT)
+            business['amalgamationOut'] = filing_info
+
path: legal-api/src/legal_api/reports/business_document.py
user: login: vysakh-menon-aot
body: Move this to https://github.com/bcgov/lear/blob/main/legal-api/src/legal_api/reports/business_document.py#L322

It should be part of stateFilings
created_at: 2025-04-22T22:35:20Z
author_association: COLLABORATOR
diff_hunk: @@ -43,11 +43,13 @@
                  <div class="pt-2">{{report_date_time}}</div>
                  <div class="pt-2">
                      <span class="capitalize-text">{{business.state}}</span>
-                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and stateFilings %}
+                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and (stateFilings or amalgamationOut) %}
path: legal-api/report-templates/template-parts/common/businessDetails.html
user: login: ArwenQin
body: For the stateFilings issue, I just talked with Janis. If continuationOut and amalgamationOut are included in stateFilings, it will render the stateTransition.html, and the continuationOut/amalgamationOut will show under the Dissolution/Restoration Information section, as below
![image](https://github.com/user-attachments/assets/3de23f28-63d4-4eb5-ab58-ffc96b705868)
(This is currently in dev for continued out Business Summary: https://dev.business-dashboard.bcregistry.gov.bc.ca/BC0871437)
Janis confirmed both continuationOut and amalgamationOut information should not be under the Dissolution/Restoration, and should be a separate section. She will create tickets to update continuationOut too.
created_at: 2025-04-22T22:41:15Z
author_association: CONTRIBUTOR
diff_hunk: @@ -5,5 +5,5 @@
       Court order(s) have been filed on this company. Review the filing history for impacts to business information.
    </div>
 </div>
-<div class="separator mt-4 mb-2"></div>
-{% endif %}
path: legal-api/report-templates/template-parts/common/courtOrder.html
user: login: severinbeauvais
body: Could that style come from somewhere else?

So the bottom margin doesn't need to be set here?
created_at: 2025-04-23T17:02:49Z
author_association: CONTRIBUTOR
diff_hunk: @@ -5,5 +5,5 @@
       Court order(s) have been filed on this company. Review the filing history for impacts to business information.
    </div>
 </div>
-<div class="separator mt-4 mb-2"></div>
-{% endif %}
path: legal-api/report-templates/template-parts/common/courtOrder.html
user: login: ArwenQin
body: I searched for "mb-" but didn't find it anywhere in the repo. 
Dev:
![image](https://github.com/user-attachments/assets/17791360-5f0f-4f51-81a5-38812b9be644)

Tested locally:
![image](https://github.com/user-attachments/assets/8f645823-884c-430a-8f8e-5eed6d788d69)

created_at: 2025-04-23T17:15:36Z
author_association: CONTRIBUTOR
diff_hunk: @@ -5,5 +5,5 @@
       Court order(s) have been filed on this company. Review the filing history for impacts to business information.
    </div>
 </div>
-<div class="separator mt-4 mb-2"></div>
-{% endif %}
path: legal-api/report-templates/template-parts/common/courtOrder.html
user: login: severinbeauvais
body: It looks to me like the separator should have a bit more whitespace below it. What do you think?
created_at: 2025-04-23T17:45:20Z
author_association: CONTRIBUTOR
diff_hunk: @@ -5,5 +5,5 @@
       Court order(s) have been filed on this company. Review the filing history for impacts to business information.
    </div>
 </div>
-<div class="separator mt-4 mb-2"></div>
-{% endif %}
path: legal-api/report-templates/template-parts/common/courtOrder.html
user: login: ArwenQin
body: Yes. I just added mb-4 (1 rem) to the bottom, does it look better:
![image](https://github.com/user-attachments/assets/2d47a885-114c-47f5-bfb1-0b600fc4700c)

created_at: 2025-04-23T18:03:34Z
author_association: CONTRIBUTOR
diff_hunk: @@ -43,11 +43,13 @@
                  <div class="pt-2">{{report_date_time}}</div>
                  <div class="pt-2">
                      <span class="capitalize-text">{{business.state}}</span>
-                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and stateFilings %}
+                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and (stateFilings or amalgamationOut) %}
path: legal-api/report-templates/template-parts/common/businessDetails.html
user: login: vysakh-menon-aot
body: If we move continuationOut and amalgamationOut out of stateFilings, how do we show if there are more than 1 amalgamationOut.

Test steps:
- File continuationOut
- File putBackOn (staff can do this - even though its rare case)
- File another continuationOut  
created_at: 2025-04-23T18:41:45Z
author_association: COLLABORATOR
diff_hunk: @@ -43,11 +43,13 @@
                  <div class="pt-2">{{report_date_time}}</div>
                  <div class="pt-2">
                      <span class="capitalize-text">{{business.state}}</span>
-                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and stateFilings %}
+                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and (stateFilings or amalgamationOut) %}
path: legal-api/report-templates/template-parts/common/businessDetails.html
user: login: ArwenQin
body: Got it, I'm checking with Janis
created_at: 2025-04-23T18:53:04Z
author_association: CONTRIBUTOR
diff_hunk: @@ -5,5 +5,5 @@
       Court order(s) have been filed on this company. Review the filing history for impacts to business information.
    </div>
 </div>
-<div class="separator mt-4 mb-2"></div>
-{% endif %}
path: legal-api/report-templates/template-parts/common/courtOrder.html
user: login: severinbeauvais
body: Yes, looks good to me! Thanks!

You started this conversation so I'll let you resolve it.
created_at: 2025-04-23T18:54:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -43,11 +43,13 @@
                  <div class="pt-2">{{report_date_time}}</div>
                  <div class="pt-2">
                      <span class="capitalize-text">{{business.state}}</span>
-                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and stateFilings %}
+                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and (stateFilings or amalgamationOut) %}
path: legal-api/report-templates/template-parts/common/businessDetails.html
user: login: ArwenQin
body: Janis will look into it tmr, keep it on hold for now
created_at: 2025-04-24T16:40:37Z
author_association: CONTRIBUTOR
diff_hunk: @@ -2,7 +2,7 @@
       <table class="footer-mocs-table">
         <tr>
           <td class="width-50 bold">
-            <span class="footer-mocs-table-1st-col">Ministry of Citizen's Services</span>
+            <span class="footer-mocs-table-1st-col">Ministry of Citizens' Services</span>
           </td>
path: legal-api/report-templates/template-parts/common/footerMOCS.html
user: login: ArwenQin
body: Fix the typo mentioned by Janis
![image](https://github.com/user-attachments/assets/3063315f-f2aa-4fb5-81ac-4649f3c438c5)

created_at: 2025-04-28T19:23:46Z
author_association: CONTRIBUTOR
diff_hunk: @@ -43,11 +43,13 @@
                  <div class="pt-2">{{report_date_time}}</div>
                  <div class="pt-2">
                      <span class="capitalize-text">{{business.state}}</span>
-                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and stateFilings %}
+                     {% if business.state in ('HISTORICAL', 'LIQUIDATION') and (stateFilings or amalgamationOut) %}
path: legal-api/report-templates/template-parts/common/businessDetails.html
user: login: ArwenQin
body: Confirmed with Janis: Under Dissolution/Restoration, only shows the Put back
Show the **last** Continue Out/ Amalgamate Out under Continued/Amalgamated Out Information
![image](https://github.com/user-attachments/assets/3fdaf544-225c-4638-934f-34f4ec2ed34f)


![image](https://github.com/user-attachments/assets/6f42c2cc-b16f-4544-ab8a-6d92d3da0890)


created_at: 2025-04-28T19:25:25Z
author_association: CONTRIBUTOR
diff_hunk: @@ -545,6 +547,29 @@ def _set_amalgamating_details(self, business: dict):
             # (if a business was a TED and it is now a TING). No need to show amalgamating businesses information
             business['amalgamatedEntities'] = []
 
+    def _set_amalgamation_out(self, business: dict):
+        filings = Filing.get_filings_by_types(self._business.id, ['amalgamationOut'])
+        if filings:
+            filing = filings[0]
+            filing_info = {}
path: legal-api/src/legal_api/reports/business_document.py
user: login: ArwenQin
body: only show the last filing
created_at: 2025-04-28T19:28:08Z
author_association: CONTRIBUTOR

PR comments:
user: login: ArwenQin
created_at: 2025-04-22T21:52:10Z
body: ![image](https://github.com/user-attachments/assets/a917070c-82e6-4ab6-8372-3b22ba9afa88)


Figma: https://www.figma.com/design/XGPA16tm4y28xS0ZPB586X/Consent-to-Amalgamate-Out---Amalgamate-Out?node-id=2466-1119&m=dev
author_association: CONTRIBUTOR
user: login: codecov[bot]
created_at: 2025-04-22T22:02:03Z
body: ## [Codecov](https://app.codecov.io/gh/bcgov/lear/pull/3418?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov) Report
Attention: Patch coverage is `15.00000%` with `17 lines` in your changes missing coverage. Please review.
> Project coverage is 74.78%. Comparing base [(`a9be147`)](https://app.codecov.io/gh/bcgov/lear/commit/a9be147a3ca006c543d83ad65fa77a1d228c8c7b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov) to head [(`3a5263a`)](https://app.codecov.io/gh/bcgov/lear/commit/3a5263a0c2eb1d558210ef81bcba44c6520a8a4e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov).
> Report is 17 commits behind head on main.

| [Files with missing lines](https://app.codecov.io/gh/bcgov/lear/pull/3418?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov) | Patch % | Lines |
|---|---|---|
| [...gal-api/src/legal\_api/reports/business\_document.py](https://app.codecov.io/gh/bcgov/lear/pull/3418?src=pr&el=tree&filepath=legal-api%2Fsrc%2Flegal_api%2Freports%2Fbusiness_document.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov#diff-bGVnYWwtYXBpL3NyYy9sZWdhbF9hcGkvcmVwb3J0cy9idXNpbmVzc19kb2N1bWVudC5weQ==) | 15.00% | [16 Missing and 1 partial :warning: ](https://app.codecov.io/gh/bcgov/lear/pull/3418?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov) |

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##             main    #3418      +/-   ##
==========================================
+ Coverage   66.60%   74.78%   +8.17%     
==========================================
  Files         268      233      -35     
  Lines       18651    15480    -3171     
  Branches     2571     2595      +24     
==========================================
- Hits        12423    11576     -847     
+ Misses       5496     3159    -2337     
- Partials      732      745      +13     
```

| [Flag](https://app.codecov.io/gh/bcgov/lear/pull/3418/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov) | Coverage Δ | |
|---|---|---|
| [colinapi](https://app.codecov.io/gh/bcgov/lear/pull/3418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov) | `?` | |
| [entityemailer](https://app.codecov.io/gh/bcgov/lear/pull/3418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov) | `66.76% <ø> (+0.16%)` | :arrow_up: |
| [legalapi](https://app.codecov.io/gh/bcgov/lear/pull/3418/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov) | `75.99% <15.00%> (+0.03%)` | :arrow_up: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Files with missing lines](https://app.codecov.io/gh/bcgov/lear/pull/3418?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov) | Coverage Δ | |
|---|---|---|
| [legal-api/src/legal\_api/core/filing.py](https://app.codecov.io/gh/bcgov/lear/pull/3418?src=pr&el=tree&filepath=legal-api%2Fsrc%2Flegal_api%2Fcore%2Ffiling.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov#diff-bGVnYWwtYXBpL3NyYy9sZWdhbF9hcGkvY29yZS9maWxpbmcucHk=) | `86.93% <ø> (ø)` | |
| [legal-api/src/legal\_api/reports/report.py](https://app.codecov.io/gh/bcgov/lear/pull/3418?src=pr&el=tree&filepath=legal-api%2Fsrc%2Flegal_api%2Freports%2Freport.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov#diff-bGVnYWwtYXBpL3NyYy9sZWdhbF9hcGkvcmVwb3J0cy9yZXBvcnQucHk=) | `23.75% <ø> (ø)` | |
| [...rocessors/consent\_amalgamation\_out\_notification.py](https://app.codecov.io/gh/bcgov/lear/pull/3418?src=pr&el=tree&filepath=queue_services%2Fentity-emailer%2Fsrc%2Fentity_emailer%2Femail_processors%2Fconsent_amalgamation_out_notification.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov#diff-cXVldWVfc2VydmljZXMvZW50aXR5LWVtYWlsZXIvc3JjL2VudGl0eV9lbWFpbGVyL2VtYWlsX3Byb2Nlc3NvcnMvY29uc2VudF9hbWFsZ2FtYXRpb25fb3V0X25vdGlmaWNhdGlvbi5weQ==) | `66.66% <ø> (+5.95%)` | :arrow_up: |
| [...gal-api/src/legal\_api/reports/business\_document.py](https://app.codecov.io/gh/bcgov/lear/pull/3418?src=pr&el=tree&filepath=legal-api%2Fsrc%2Flegal_api%2Freports%2Fbusiness_document.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov#diff-bGVnYWwtYXBpL3NyYy9sZWdhbF9hcGkvcmVwb3J0cy9idXNpbmVzc19kb2N1bWVudC5weQ==) | `44.62% <15.00%> (-1.43%)` | :arrow_down: |

... and [40 files with indirect coverage changes](https://app.codecov.io/gh/bcgov/lear/pull/3418/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bcgov)

</details>
<details><summary> :rocket: New features to boost your workflow: </summary>

- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
author_association: NONE
user: login: ArwenQin
created_at: 2025-04-22T22:07:59Z
body: Another example output:
![image](https://github.com/user-attachments/assets/dc192009-875e-4e20-b190-35a59b51599d)


author_association: CONTRIBUTOR
user: login: ArwenQin
created_at: 2025-04-28T19:26:50Z
body: Multiple put backs and amalgamated outs:
Show put backs under Dissolution/Restoration
Show the last Amalgamate Out under Amalgamated Out Information

![image](https://github.com/user-attachments/assets/dd2b54b6-ad6b-4ff9-a592-f287a4f01550)

author_association: CONTRIBUTOR
user: login: ArwenQin
created_at: 2025-04-28T19:27:36Z
body: @vysakh-menon-aot @severinbeauvais 
I just confirmed the design requirements with Janis. Could you please review, thank you so much
author_association: CONTRIBUTOR
user: login: ArwenQin
created_at: 2025-04-29T15:52:09Z
body: @severinbeauvais Hi Severin, is it ok to merge? Thank you again!
author_association: CONTRIBUTOR