From 2d0213705f77610bd0ffef92c2e65ae6144ad0d5 Mon Sep 17 00:00:00 2001 From: Ryan Nolan Date: Wed, 7 Oct 2020 12:04:20 +0100 Subject: [PATCH] Seperate client dashboard from homepage. Its always seemed strange that the homepage gets replaced by the client dashboard when logged in... from a user experience perspective that seems a little counter intuitive. This commit chnages this so that the home page is its own page. --- .../Dashboard/Controller/Client.php | 46 ++++ .../html_client/mod_dashboard_index.phtml | 230 ++++++++++++++++ src/bb-modules/Dashboard/manifest.json | 7 + .../boxbilling/html/layout_default.phtml | 2 +- .../boxbilling/html/mod_dashboard_index.phtml | 248 ++++++++++++++++++ .../boxbilling/html/mod_index_dashboard.phtml | 222 ---------------- 6 files changed, 532 insertions(+), 223 deletions(-) create mode 100644 src/bb-modules/Dashboard/Controller/Client.php create mode 100644 src/bb-modules/Dashboard/html_client/mod_dashboard_index.phtml create mode 100644 src/bb-modules/Dashboard/manifest.json create mode 100644 src/bb-themes/boxbilling/html/mod_dashboard_index.phtml diff --git a/src/bb-modules/Dashboard/Controller/Client.php b/src/bb-modules/Dashboard/Controller/Client.php new file mode 100644 index 000000000..cc6dae342 --- /dev/null +++ b/src/bb-modules/Dashboard/Controller/Client.php @@ -0,0 +1,46 @@ +di = $di; + } + + /** + * @return mixed + */ + public function getDi() + { + return $this->di; + } + + public function register(\Box_App &$app) + { + $app->get('/dashboard', 'get_dashboard_index', array(), get_class($this)); + } + + public function get_dashboard_index(\Box_App $app) + { + $this->di['is_client_logged']; + return $app->render('mod_dashboard_index'); + } +} \ No newline at end of file diff --git a/src/bb-modules/Dashboard/html_client/mod_dashboard_index.phtml b/src/bb-modules/Dashboard/html_client/mod_dashboard_index.phtml new file mode 100644 index 000000000..85170634c --- /dev/null +++ b/src/bb-modules/Dashboard/html_client/mod_dashboard_index.phtml @@ -0,0 +1,230 @@ +{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %} + +{% block meta_title %}{% trans 'Client Area' %}{% endblock %} +{% block page_header %}{% trans 'Dashboard' %}{% endblock %} + +{% block breadcrumbs %} + {% if not settings.hide_dashboard_breadcrumb %} + + {% endif %} +{% endblock %} + +{% import "macro_functions.phtml" as mf %} + +{% block content %} + +{% if settings.showcase_enabled %} +
+

{{ settings.showcase_heading }}

+

{{ settings.showcase_text }}

+

{{ settings.showcase_button_title }}

+
+{% endif %} + +{% if client %} + +{% set tickets = client.support_ticket_get_list({"status":'on_hold'}) %} +{% if tickets.total > 0 %} +
+
+
+
+

{% trans 'Tickets waiting your reply' %}

+
+
+ + + + + + + + + + + + + {% for i, ticket in tickets.list %} + + + + + + + + + + + {% else %} + + + + + + {% endfor %} + + +
{% trans 'Id' %}{% trans 'Subject' %}{% trans 'Help desk' %}{% trans 'Status' %}{% trans 'Submitted' %}{% trans 'Actions' %}
{{ticket.id}}{{ticket.subject}}{{ticket.helpdesk.name}}{{mf.status_name(ticket.status)}}{{ticket.created_at|bb_date}}{% trans 'Reply' %}
{% trans 'The list is empty' %}
+
+
+
+
+{% endif %} + +
+{% set profile = client.client_get %} +
+
+
+

{% trans 'Profile' %}

+ +
+
+
+
{% trans 'ID' %}
+
#{{ profile.id }}
+
{% trans 'Email' %}
+
{{ profile.email }}
+
{% trans 'Balance' %}
+
{{ profile.balance | money(profile.currency) }}
+
+
+
+
+ +
+
+
+

{% trans 'Invoices' %}

+ +
+
+
+
{% trans 'Total' %}
+
{{ client.invoice_get_list().total }}
+
{% trans 'Paid' %}
+
{{ client.invoice_get_list({"status":"paid"}).total }}
+
{% trans 'Unpaid' %}
+
{{ client.invoice_get_list({"status":"unpaid"}).total }}
+
+
+
+
+
+ +
+ +
+
+
+

{% trans 'Orders' %}

+ +
+
+
+
{% trans 'Total' %}
+
{{ client.order_get_list({"hide_addons":1}).total }}
+
{% trans 'Active' %}
+
{{ client.order_get_list({"hide_addons":1, "status":"active"}).total }}
+
{% trans 'Expiring' %}
+
{{ client.order_get_list({"expiring":1}).total }}
+
+
+
+
+ +
+
+
+

{% trans 'Tickets' %}

+ +
+
+
+
{% trans 'Total' %}
+
{{ client.support_ticket_get_list().total }}
+
{% trans 'Open' %}
+
{{ client.support_ticket_get_list({"status":'open'}).total }}
+
{% trans 'On Hold' %}
+
{{ client.support_ticket_get_list({"status":'on_hold'}).total }}
+
+
+
+
+
+ +
+ +
+
+
+

{% trans 'Recent orders' %}

+
+
+ + + {% for i, order in client.order_get_list({"per_page":5, "page":request.page, "hide_addons":1}).list %} + + + + + {% else %} + + + + {% endfor %} + +
{{ order.title|truncate(30) }}{{ mf.status_name(order.status) }}
{% trans 'The list is empty' %}
+
+
+
+ +
+
+
+

{% trans 'Recent emails' %}

+
+
+ + + {% for i, email in client.email_get_list({"per_page":5}).list %} + + + + + {% else %} + + + + {% endfor %} + +
{{email.subject|truncate(30)}}{{ email.created_at|timeago }} {% trans 'ago' %}
{% trans 'The list is empty' %}
+
+
+
+ +
+ +{% endif %} +{% endblock %} \ No newline at end of file diff --git a/src/bb-modules/Dashboard/manifest.json b/src/bb-modules/Dashboard/manifest.json new file mode 100644 index 000000000..88bcd0704 --- /dev/null +++ b/src/bb-modules/Dashboard/manifest.json @@ -0,0 +1,7 @@ +{ + "id": "dashboard", + "type": "mod", + "name": "Client dashboard module", + "description": "Displays a dashboard for clients that are loggedin", + "version": "1.0.0" +} \ No newline at end of file diff --git a/src/bb-themes/boxbilling/html/layout_default.phtml b/src/bb-themes/boxbilling/html/layout_default.phtml index c1dd429d6..2d7ce41fe 100644 --- a/src/bb-themes/boxbilling/html/layout_default.phtml +++ b/src/bb-themes/boxbilling/html/layout_default.phtml @@ -47,7 +47,7 @@ {% if client %}