Skip to content

Commit 436c3e6

Browse files
authored
Merge pull request #105 from companieshouse/PCI-554-update-view-all-tab
Pci 554 update view all tab
2 parents a17afa6 + cb1adfa commit 436c3e6

File tree

2 files changed

+121
-53
lines changed

2 files changed

+121
-53
lines changed

lib/ChGovUk/Controllers/Company/ViewAll.pm

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,70 @@ package ChGovUk::Controllers::Company::ViewAll;
33
use Mojo::Base 'Mojolicious::Controller';
44
use CH::Perl;
55

6+
my @snapshot_company_types = (
7+
"assurance-company",
8+
"industrial-and-provident-society",
9+
"royal-charter",
10+
"investment-company-with-variable-capital",
11+
"charitable-incorporated-organisation",
12+
"scottish-charitable-incorporated-organisation",
13+
"uk-establishment",
14+
"registered-society-non-jurisdictional",
15+
"protected-cell-company",
16+
"eeig",
17+
"protected-cell-company",
18+
"further-education-or-sixth-form-college-corporation",
19+
"icvc-securities",
20+
"icvc-warrant",
21+
"icvc-umbrella");
22+
23+
my @orders_company_types = (
24+
"limited-partnership",
25+
"llp",
26+
"ltd",
27+
"plc",
28+
"old-public-company",
29+
"private-limited-guarant-nsc",
30+
"private-limited-guarant-nsc-limited-exemption",
31+
"private-limited-shares-section-30-exemption",
32+
"private-unlimited",
33+
"private-unlimited-nsc",
34+
"scottish-partnership");
35+
636
#-------------------------------------------------------------------------------
737

838
# View All Tab
939
sub view {
1040
my ($self) = @_;
1141

12-
return $self->render;
42+
my $company = $self->stash->{company};
43+
my $company_type = $company->{type};
44+
my $company_status = $company->{company_status};
45+
my $show_snapshot = 1;
46+
my $show_orders = 0;
47+
48+
for (my $i=0; $i < @snapshot_company_types; $i++) {
49+
if ($company_type eq $snapshot_company_types[$i]) {
50+
$show_snapshot = 0;
51+
}
52+
}
53+
54+
if ($company_status eq 'active') {
55+
for (my $j=0; $j < @orders_company_types; $j++) {
56+
if ($company_type eq $orders_company_types[$j]) {
57+
$show_orders = 1;
58+
}
59+
}
60+
}
61+
62+
$self->stash(show_snapshot => $show_snapshot);
63+
$self->stash(show_orders => $show_orders);
64+
65+
if ($show_snapshot || $show_orders) {
66+
return $self->render(template => 'company/view_all/view');
67+
} else {
68+
return $self->render(template => 'not_found.production');
69+
}
1370
}
1471

1572
#-------------------------------------------------------------------------------

templates/company/view_all/view.html.tx

Lines changed: 63 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,76 @@
22

33
% around content -> {
44

5-
% if $company.type != "assurance-company" && $company.type != "industrial-and-provident-society" && $company.type != "royal-charter" && $company.type != "investment-company-with-variable-capital" && $company.type != "charitable-incorporated-organisation" && $company.type != "scottish-charitable-incorporated-organisation" && $company.type != "uk-establishment" && $company.type != "registered-society-non-jurisdictional" && $company.type != "protected-cell-company" && $company.type != "eeig" && $company.type != "protected-cell-company" && $company.type != "further-education-or-sixth-form-college-corporation" && $company.type != "icvc-securities" && $company.type != "icvc-warrant" && $company.type != "icvc-umbrella" {
6-
7-
% include '/includes/company/page_header.tx'
8-
9-
% include '/includes/company/tabs.tx' { active => 'view-all-tab' };
10-
11-
<details class="govuk-details" role="group">
12-
<summary class="govuk-details__summary" role="button" aria-controls="details-content" aria-expanded="true">
13-
<span class="govuk-details__summary-text">
14-
What's included?
15-
</span>
16-
</summary>
17-
<div class="govuk-details__text" id="details-content" aria-hidden="false">
18-
<p>The latest 100 entries for:</p>
19-
<ul class="govuk-list govuk-list--bullet">
20-
<li>Filing history</li>
21-
<li>Officers</li>
22-
<li>Persons with significant control</li>
23-
<li>Charges</li>
24-
<li>Insolvency</li>
25-
<li>Registers</li>
26-
</ul>
27-
</div>
28-
</details>
5+
% if $show_snapshot {
6+
% include '/includes/company/page_header.tx'
297

8+
% include '/includes/company/tabs.tx' { active => 'view-all-tab' };
9+
<h2 id="company-snapshot-header" class="heading-large">
10+
Company snapshot <%$company_type%>
11+
</h2>
12+
<details class="govuk-details" role="group">
13+
<summary class="govuk-details__summary" role="button" aria-controls="details-content" aria-expanded="true">
14+
<span class="govuk-details__summary-text">
15+
What's included in the company snapshot?
16+
</span>
17+
</summary>
18+
<div class="govuk-details__text" id="details-content" aria-hidden="false">
19+
<p>The latest 100 entries for:</p>
20+
<ul class="govuk-list govuk-list--bullet">
21+
<li>Filing history</li>
22+
<li>Officers</li>
23+
<li>Persons with significant control</li>
24+
<li>Charges</li>
25+
<li>Insolvency</li>
26+
<li>Registers</li>
27+
</ul>
28+
</div>
29+
</details>
3030

3131
% if $c.is_signed_in {
32-
<div class="govuk-inset-text onlyJS">
33-
<div id="widget">
34-
<a class="render-document govuk-button secondary-button piwik-event" data-event-id="View company information snapshot" href="#">View company information snapshot
35-
<span class="govuk-visually-hidden">link opens in new tab/window</span></a>
36-
<div id="status-widget" class="widget-footer hidden">
37-
<div id="status">
38-
<div id="process-spinner" class="process-spinner"></div>
39-
<span id="process-status" class="process-status">Status: in-progress</span>
32+
<div class="govuk-inset-text onlyJS">
33+
<div id="widget">
34+
<a class="render-document govuk-button secondary-button" data-event-id="View company information snapshot" href="#">View company information snapshot
35+
<span class="govuk-visually-hidden">link opens in new tab/window</span></a>
36+
<div id="status-widget" class="widget-footer hidden">
37+
<div id="status">
38+
<div id="process-spinner" class="process-spinner"></div>
39+
<span id="process-status" class="process-status">Status: in-progress</span>
40+
</div>
41+
<input type="hidden" id="document-data"
42+
data-resource-url="/company-number/<%$company.company_number%>"
43+
data-content-type="text/html" data-document-type="text/html">
44+
</input>
4045
</div>
41-
<input type="hidden" id="document-data"
42-
data-resource-url="/company-number/<%$company.company_number%>"
43-
data-content-type="text/html" data-document-type="text/html">
44-
</input>
4546
</div>
4647
</div>
47-
</div>
48-
<div id="download-button"></div>
49-
% } else {
50-
<a class="govuk-button secondary-button piwik-event" data-event-id="View company information snapshot" href="<% $c.url_for('user_sign_in') %>">View company information snapshot
51-
<span class="govuk-visually-hidden">link opens in new tab/window</span></a>
48+
<div id="download-button"></div>
49+
% } else {
50+
<a class="govuk-button secondary-button" data-event-id="View company information snapshot" href="<% $c.url_for('user_sign_in') %>">View company information snapshot
51+
<span class="govuk-visually-hidden">link opens in new tab/window</span></a>
5252
% }
53-
54-
% } else {
55-
<article class="text">
56-
<header>
57-
<h1 id="page-not-found-header" class="heading-xlarge">
58-
This page cannot be found
59-
</h1>
60-
</header>
61-
<p>Check that you have entered the correct web address or try using the search.</p>
62-
<p>If you still can't find what you're looking for email <a href="mailto:[email protected]">[email protected]</a></p>
63-
</article>
6453
% }
54+
55+
% if $show_orders {
56+
<h2 id="order-a-certificate-header" class="heading-large heading-with-border">
57+
Order a certificate
58+
</h2>
59+
<details class="govuk-details" role="group">
60+
<summary class="govuk-details__summary" role="button" aria-controls="details-content" aria-expanded="true">
61+
<span class="govuk-details__summary-text">
62+
What you can order
63+
</span>
64+
</summary>
65+
<div class="govuk-details__text" id="details-content" aria-hidden="false">
66+
<p>You can:</p>
67+
<ul class="govuk-list govuk-list--bullet">
68+
<li>order a certificate of incorporation</li>
69+
<li>include good standing information</li>
70+
<li>pay by debit or credit card</li>
71+
</ul>
72+
</div>
73+
</details>
74+
<a class="govuk-button secondary-button" data-event-id="Order a certificate" href="<% $c.url_for('/orderable/certificates') %>">Order certificate</a>
6575
% }
76+
% }
6677
% }

0 commit comments

Comments
 (0)