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.
This commit is contained in:
Ryan Nolan committed 2020-10-07 12:04:20 +01:00
1 parent f050b51127
commit 2d0213705f
6 files changed
+532 -223

No files matched your search

@@ -0,0 +1,46 @@
<?php
/**
* BoxBilling
*
* @copyright BoxBilling, Inc (http://www.boxbilling.com)
* @license Apache-2.0
*
* Copyright BoxBilling, Inc
* This source file is subject to the Apache-2.0 License that is bundled
* with this source code in the file LICENSE
*/
namespace Box\Mod\Dashboard\Controller;
class Client implements \Box\InjectionAwareInterface
{
protected $di;
/**
* @param mixed $di
*/
public function setDi($di)
{
$this->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');
}
}
@@ -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 %}
<ul class="breadcrumb">
<li><a href="{{ '/'|link }}">{% trans 'Home' %}</a> <span class="divider">/</span></li>
<li class="active">{% trans 'Dashboard' %}</li>
</ul>
{% endif %}
{% endblock %}
{% import "macro_functions.phtml" as mf %}
{% block content %}
{% if settings.showcase_enabled %}
<div class="hero-unit">
<h1>{{ settings.showcase_heading }}</h1>
<p>{{ settings.showcase_text }}</p>
<p><a class="btn btn-alt btn-primary btn-large" href="{{ settings.showcase_button_url }}">{{ settings.showcase_button_title }}</a></p>
</div>
{% endif %}
{% if client %}
{% set tickets = client.support_ticket_get_list({"status":'on_hold'}) %}
{% if tickets.total > 0 %}
<div class="row">
<article class="span12 data-block">
<div class="data-container">
<header>
<h2>{% trans 'Tickets waiting your reply' %}</h2>
</header>
<section id="slimScroll1">
<table class="table table-striped table-bordered table-condensed table-hover">
<thead>
<tr>
<th>{% trans 'Id' %}</th>
<th>{% trans 'Subject' %}</th>
<th>{% trans 'Help desk' %}</th>
<th>{% trans 'Status' %}</th>
<th>{% trans 'Submitted' %}</th>
<th>{% trans 'Actions' %}</th>
</tr>
</thead>
<tbody>
{% for i, ticket in tickets.list %}
<tr class="{{ cycle(['odd', 'even'], i) }}">
<td>{{ticket.id}}</td>
<td><a href="{{ 'support/ticket'|link }}/{{ticket.id}}">{{ticket.subject}}</a></td>
<td>{{ticket.helpdesk.name}}</td>
<td><span class="label">{{mf.status_name(ticket.status)}}</span></td>
<td>{{ticket.created_at|bb_date}}</td>
<td><a href="{{ 'support/ticket'|link }}/{{ticket.id}}" class="btn btn-small btn-inverse">{% trans 'Reply' %}</a></td>
</tr>
{% else %}
<tr>
<td colspan="5">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
</div>
</article>
</div>
{% endif %}
<div class="row">
{% set profile = client.client_get %}
<article class="span6 data-block decent">
<div class="data-container">
<header>
<h2>{% trans 'Profile' %}</h2>
<ul class="data-header-actions">
<li>
<a class="btn btn-alt btn-inverse" href="{{ 'client/me'|link }}">{% trans 'Update' %}</a>
</li>
</ul>
</header>
<section>
<dl class="dl-horizontal">
<dt>{% trans 'ID' %}</dt>
<dd>#{{ profile.id }}</dd>
<dt>{% trans 'Email' %}</dt>
<dd>{{ profile.email }}</dd>
<dt>{% trans 'Balance' %}</dt>
<dd>{{ profile.balance | money(profile.currency) }}</dd>
</dl>
</section>
</div>
</article>
<article class="span6 data-block decent">
<div class="data-container">
<header>
<h2>{% trans 'Invoices' %}</h2>
<ul class="data-header-actions">
<li>
<a class="btn btn-alt btn-inverse" href="{{ 'invoice'|link }}">{% trans 'All Invoices' %}</a>
</li>
</ul>
</header>
<section>
<dl class="dl-horizontal">
<dt>{% trans 'Total' %}</dt>
<dd>{{ client.invoice_get_list().total }}</dd>
<dt>{% trans 'Paid' %}</dt>
<dd>{{ client.invoice_get_list({"status":"paid"}).total }}</dd>
<dt>{% trans 'Unpaid' %}</dt>
<dd>{{ client.invoice_get_list({"status":"unpaid"}).total }}</dd>
</dl>
</section>
</div>
</article>
</div>
<div class="row">
<article class="span6 data-block decent">
<div class="data-container">
<header>
<h2>{% trans 'Orders' %}</h2>
<ul class="data-header-actions">
<li>
<a class="btn btn-alt btn-info order-button" href="{{ 'order'|link }}">{% trans 'New order' %}</a>
<a class="btn btn-alt btn-inverse" href="{{ 'order/service'|link }}">{% trans 'All orders' %}</a>
</li>
</ul>
</header>
<section>
<dl class="dl-horizontal">
<dt>{% trans 'Total' %}</dt>
<dd>{{ client.order_get_list({"hide_addons":1}).total }}</dd>
<dt>{% trans 'Active' %}</dt>
<dd>{{ client.order_get_list({"hide_addons":1, "status":"active"}).total }}</dd>
<dt>{% trans 'Expiring' %}</dt>
<dd>{{ client.order_get_list({"expiring":1}).total }}</dd>
</dl>
</section>
</div>
</article>
<article class="span6 data-block decent">
<div class="data-container">
<header>
<h2>{% trans 'Tickets' %}</h2>
<ul class="data-header-actions">
<li>
<a class="btn btn-alt btn-info" href="{{ 'support'|link({'ticket' : 1}) }}">{% trans 'New ticket' %}</a>
<a class="btn btn-alt btn-inverse" href="{{ 'support'|link }}">{% trans 'All tickets' %}</a>
</li>
</ul>
</header>
<section>
<dl class="dl-horizontal">
<dt>{% trans 'Total' %}</dt>
<dd>{{ client.support_ticket_get_list().total }}</dd>
<dt>{% trans 'Open' %}</dt>
<dd>{{ client.support_ticket_get_list({"status":'open'}).total }}</dd>
<dt>{% trans 'On Hold' %}</dt>
<dd>{{ client.support_ticket_get_list({"status":'on_hold'}).total }}</dd>
</dl>
</section>
</div>
</article>
</div>
<div class="row">
<article class="span6 data-block decent">
<div class="data-container">
<header>
<h2>{% trans 'Recent orders' %}</h2>
</header>
<section>
<table class="table table-striped table-bordered table-condensed table-hover">
<tbody>
{% for i, order in client.order_get_list({"per_page":5, "page":request.page, "hide_addons":1}).list %}
<tr class="{{ cycle(['odd', 'even'], i) }}">
<td><a href="{{ 'order/service/manage'|link }}/{{order.id}}">{{ order.title|truncate(30) }}</a></td>
<td><span class="label {% if order.status == 'active'%}label-success{% elseif order.status == 'pending_setup' %}label-warning{% endif %}">{{ mf.status_name(order.status) }}</span></td>
</tr>
{% else %}
<tr>
<td colspan="3">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
</div>
</article>
<article class="span6 data-block decent">
<div class="data-container">
<header>
<h2>{% trans 'Recent emails' %}</h2>
</header>
<section>
<table class="table table-striped table-bordered table-condensed table-hover">
<tbody>
{% for i, email in client.email_get_list({"per_page":5}).list %}
<tr class="{{ cycle(['odd', 'even'], i) }}">
<td><a href="{{ 'email'|link }}/{{email.id}}">{{email.subject|truncate(30)}}</a></td>
<td title="{{ email.created_at|bb_date }}">{{ email.created_at|timeago }} {% trans 'ago' %}</td>
</tr>
{% else %}
<tr>
<td colspan="2">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
</div>
</article>
</div>
{% endif %}
{% endblock %}
+7
View File
@@ -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"
}
@@ -47,7 +47,7 @@
{% if client %}
<ul class="middleNav">
<li>
<a href="{{ ''|link }}" class="show-tip" title="{% trans 'Dashboard' %}"><span class="big-dark-icon i-home"></span></a>
<a href="{{ 'dashboard'|link }}" class="show-tip" title="{% trans 'Dashboard' %}"><span class="big-dark-icon i-home"></span></a>
</li>
<li>
<a href="{{ 'cart'|link }}" class="show-tip" title="{% trans 'Shopping cart' %}"><span class="big-dark-icon i-cart"></span></a>
@@ -0,0 +1,248 @@
{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %}
{% block meta_title %}{% trans 'Client Area' %}{% endblock %}
{% import "macro_functions.phtml" as mf %}
{% block content %}
<div class="dashboard">
{% set tickets = client.support_ticket_get_list({"status":'on_hold'}) %}
{% if tickets.total > 0 %}
<div class="widget">
<div class="head">
<h2 class="dark-icon i-support">{% trans 'Tickets waiting your reply' %}</h2>
</div>
<table>
<thead>
<tr>
<th>{% trans 'Id' %}</th>
<th>{% trans 'Subject' %}</th>
<th>{% trans 'Help desk' %}</th>
<th>{% trans 'Status' %}</th>
<th>{% trans 'Submitted' %}</th>
</tr>
</thead>
<tbody>
{% for i, ticket in tickets.list %}
<tr class="{{ cycle(['odd', 'even'], i) }}">
<td>{{ticket.id}}</td>
<td><a href="{{ 'support/ticket'|link }}/{{ticket.id}}">{{ticket.subject}}</a></td>
<td>{{ticket.helpdesk.name}}</td>
<td>{{mf.status_name(ticket.status)}}</td>
<td>{{ticket.created_at|bb_date}}</td>
</tr>
{% else %}
<tr>
<td colspan="5">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% set profile = client.client_get %}
<div class="grid_6 alpha">
<div class="widget">
<div class="head">
<h2 class="dark-icon i-profile">{% trans 'Profile' %}</h2>
</div>
<table>
<tbody>
<tr>
<td>{% trans 'ID' %}</td>
<td>#{{ profile.id }}</td>
</tr>
<tr>
<td>{% trans 'Email' %}</td>
<td>{{ profile.email }}</td>
</tr>
<tr>
<td>{% trans 'Balance' %}</td>
<td>{{ profile.balance | money(profile.currency) }}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">
<a class="bb-button" href="{{ 'client/me'|link }}">{% trans 'Manage profile' %}</a>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="grid_6 omega">
<div class="widget">
<div class="head">
<h2 class="dark-icon i-invoice">{% trans 'Invoices' %}</h2>
</div>
<table>
<tbody>
<tr>
<td>{% trans 'Total' %}</td>
<td>{{ client.invoice_get_list().total }}</td>
</tr>
<tr>
<td>{% trans 'Paid' %}</td>
<td>{{ client.invoice_get_list({"status":"paid"}).total }}</td>
</tr>
<tr>
<td>{% trans 'Unpaid' %}</td>
<td>{{ client.invoice_get_list({"status":"unpaid"}).total }}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">
<a class="bb-button" href="{{ 'invoice'|link }}">{% trans 'All Invoices' %}</a>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="grid_6 alpha">
<div class="widget">
<div class="head">
<h2 class="dark-icon i-services">{% trans 'Services' %}</h2>
</div>
<table>
<tbody>
<tr>
<td>{% trans 'Total' %}</td>
<td>{{ client.order_get_list({"hide_addons":1}).total }}</td>
</tr>
<tr>
<td>{% trans 'Active' %}</td>
<td>{{ client.order_get_list({"hide_addons":1, "status":"active"}).total }}</td>
</tr>
<tr>
<td>{% trans 'Soon expires' %}</td>
<td>{{ client.order_get_list({"expiring":1}).total }}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">
<a class="bb-button" href="{{ 'order/service'|link }}">{% trans 'All services' %}</a>
<a class="bb-button bb-button-submit" href="{{ 'order'|link }}">{% trans 'New order' %}</a>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="grid_6 omega">
<div class="widget">
<div class="head">
<h2 class="dark-icon i-support">{% trans 'Tickets' %}</h2>
</div>
<table>
<tbody>
<tr>
<td>{% trans 'Total' %}</td>
<td>{{ client.support_ticket_get_list().total }}</td>
</tr>
<tr>
<td>{% trans 'Open' %}</td>
<td>{{ client.support_ticket_get_list({"status":'open'}).total }}</td>
</tr>
<tr>
<td>{% trans 'On Hold' %}</td>
<td>{{ client.support_ticket_get_list({"status":'on_hold'}).total }}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">
<a class="bb-button" href="{{ 'support'|link }}">{% trans 'All tickets' %}</a>
<a class="bb-button bb-button-submit" href="{{ 'support'|link({'ticket' : 1}) }}">{% trans 'New ticket' %}</a>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="grid_6 alpha">
<div class="widget">
<div class="head">
<h2 class="dark-icon i-order">{% trans 'Recent orders' %}</h2>
</div>
<table>
<tbody>
{% for i, order in client.order_get_list({"per_page":5, "page":request.page, "hide_addons":1}).list %}
<tr class="{{ cycle(['odd', 'even'], i) }}">
<td><a href="{{ 'order/service/manage'|link }}/{{order.id}}">{{ order.title|truncate(30) }}</a></td>
<td>{{ mf.status_name(order.status) }}</td>
</tr>
{% else %}
<tr>
<td colspan="3">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="grid_6 omega">
<div class="widget">
<div class="head">
<h2 class="dark-icon i-email">{% trans 'Recent emails' %}</h2>
</div>
<table>
<tbody>
{% for i, email in client.email_get_list({"per_page":5}).list %}
<tr class="{{ cycle(['odd', 'even'], i) }}">
<td><a href="{{ 'email'|link }}/{{email.id}}">{{email.subject|truncate(30)}}</a></td>
<td title="{{ email.created_at|bb_date }}">{{ email.created_at|timeago }} {% trans 'ago' %}</td>
</tr>
{% else %}
<tr>
<td colspan="2">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="clear"></div>
</div>
{% endblock %}
{% block js %}
<script type="text/javascript">
$(function() {
$('#client-login').bind('submit',function(event){
bb.post(
'guest/client/login',
$(this).serialize(),
function(result) {
bb.redirect();
}
);
return false;
});
});
</script>
{% endblock %}
@@ -5,227 +5,6 @@
{% block content %}
<div class="dashboard">
{% if client %}
{% set tickets = client.support_ticket_get_list({"status":'on_hold'}) %}
{% if tickets.total > 0 %}
<div class="widget">
<div class="head">
<h2 class="dark-icon i-support">{% trans 'Tickets waiting your reply' %}</h2>
</div>
<table>
<thead>
<tr>
<th>{% trans 'Id' %}</th>
<th>{% trans 'Subject' %}</th>
<th>{% trans 'Help desk' %}</th>
<th>{% trans 'Status' %}</th>
<th>{% trans 'Submitted' %}</th>
</tr>
</thead>
<tbody>
{% for i, ticket in tickets.list %}
<tr class="{{ cycle(['odd', 'even'], i) }}">
<td>{{ticket.id}}</td>
<td><a href="{{ 'support/ticket'|link }}/{{ticket.id}}">{{ticket.subject}}</a></td>
<td>{{ticket.helpdesk.name}}</td>
<td>{{mf.status_name(ticket.status)}}</td>
<td>{{ticket.created_at|bb_date}}</td>
</tr>
{% else %}
<tr>
<td colspan="5">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% set profile = client.client_get %}
<div class="grid_6 alpha">
<div class="widget">
<div class="head">
<h2 class="dark-icon i-profile">{% trans 'Profile' %}</h2>
</div>
<table>
<tbody>
<tr>
<td>{% trans 'ID' %}</td>
<td>#{{ profile.id }}</td>
</tr>
<tr>
<td>{% trans 'Email' %}</td>
<td>{{ profile.email }}</td>
</tr>
<tr>
<td>{% trans 'Balance' %}</td>
<td>{{ profile.balance | money(profile.currency) }}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">
<a class="bb-button" href="{{ 'client/me'|link }}">{% trans 'Manage profile' %}</a>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="grid_6 omega">
<div class="widget">
<div class="head">
<h2 class="dark-icon i-invoice">{% trans 'Invoices' %}</h2>
</div>
<table>
<tbody>
<tr>
<td>{% trans 'Total' %}</td>
<td>{{ client.invoice_get_list().total }}</td>
</tr>
<tr>
<td>{% trans 'Paid' %}</td>
<td>{{ client.invoice_get_list({"status":"paid"}).total }}</td>
</tr>
<tr>
<td>{% trans 'Unpaid' %}</td>
<td>{{ client.invoice_get_list({"status":"unpaid"}).total }}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">
<a class="bb-button" href="{{ 'invoice'|link }}">{% trans 'All Invoices' %}</a>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="grid_6 alpha">
<div class="widget">
<div class="head">
<h2 class="dark-icon i-services">{% trans 'Services' %}</h2>
</div>
<table>
<tbody>
<tr>
<td>{% trans 'Total' %}</td>
<td>{{ client.order_get_list({"hide_addons":1}).total }}</td>
</tr>
<tr>
<td>{% trans 'Active' %}</td>
<td>{{ client.order_get_list({"hide_addons":1, "status":"active"}).total }}</td>
</tr>
<tr>
<td>{% trans 'Soon expires' %}</td>
<td>{{ client.order_get_list({"expiring":1}).total }}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">
<a class="bb-button" href="{{ 'order/service'|link }}">{% trans 'All services' %}</a>
<a class="bb-button bb-button-submit" href="{{ 'order'|link }}">{% trans 'New order' %}</a>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="grid_6 omega">
<div class="widget">
<div class="head">
<h2 class="dark-icon i-support">{% trans 'Tickets' %}</h2>
</div>
<table>
<tbody>
<tr>
<td>{% trans 'Total' %}</td>
<td>{{ client.support_ticket_get_list().total }}</td>
</tr>
<tr>
<td>{% trans 'Open' %}</td>
<td>{{ client.support_ticket_get_list({"status":'open'}).total }}</td>
</tr>
<tr>
<td>{% trans 'On Hold' %}</td>
<td>{{ client.support_ticket_get_list({"status":'on_hold'}).total }}</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">
<a class="bb-button" href="{{ 'support'|link }}">{% trans 'All tickets' %}</a>
<a class="bb-button bb-button-submit" href="{{ 'support'|link({'ticket' : 1}) }}">{% trans 'New ticket' %}</a>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="grid_6 alpha">
<div class="widget">
<div class="head">
<h2 class="dark-icon i-order">{% trans 'Recent orders' %}</h2>
</div>
<table>
<tbody>
{% for i, order in client.order_get_list({"per_page":5, "page":request.page, "hide_addons":1}).list %}
<tr class="{{ cycle(['odd', 'even'], i) }}">
<td><a href="{{ 'order/service/manage'|link }}/{{order.id}}">{{ order.title|truncate(30) }}</a></td>
<td>{{ mf.status_name(order.status) }}</td>
</tr>
{% else %}
<tr>
<td colspan="3">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="grid_6 omega">
<div class="widget">
<div class="head">
<h2 class="dark-icon i-email">{% trans 'Recent emails' %}</h2>
</div>
<table>
<tbody>
{% for i, email in client.email_get_list({"per_page":5}).list %}
<tr class="{{ cycle(['odd', 'even'], i) }}">
<td><a href="{{ 'email'|link }}/{{email.id}}">{{email.subject|truncate(30)}}</a></td>
<td title="{{ email.created_at|bb_date }}">{{ email.created_at|timeago }} {% trans 'ago' %}</td>
</tr>
{% else %}
<tr>
<td colspan="2">{% trans 'The list is empty' %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="clear"></div>
{% else %}
<div class="grid_6 alpha">
<div class="box">
@@ -286,7 +65,6 @@
</div>
{% endif %}
<div class="clear"></div>
{% endif %}
</div>
{% endblock %}