mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Working on d3 viz
This commit is contained in:
parent
fa676f1e57
commit
48064313cc
@ -17,7 +17,7 @@ To connect follow [@invoiceninja](https://twitter.com/invoiceninja) or join the
|
||||
|
||||
If you'd like to translate the site please use [caouecs/Laravel4-long](https://github.com/caouecs/Laravel4-lang) for the starter files.
|
||||
|
||||
Site design by [kantorp-wegl.in](http://kantorp-wegl.in/)
|
||||
Developed by [@hillelcoren](https://twitter.com/hillelcoren) | Designed by [kantorp-wegl.in](http://kantorp-wegl.in/).
|
||||
|
||||
### Features
|
||||
|
||||
@ -27,6 +27,8 @@ Site design by [kantorp-wegl.in](http://kantorp-wegl.in/)
|
||||
* Recurring invoices
|
||||
* Tax rates and payment terms
|
||||
* Multi-user support
|
||||
* [Zapier](https://zapier.com/) integration
|
||||
* [D3.js](http://d3js.org/) visualizations
|
||||
|
||||
### Steps to setup
|
||||
|
||||
|
@ -4,16 +4,24 @@ class ReportController extends \BaseController {
|
||||
|
||||
public function d3()
|
||||
{
|
||||
$account = Auth::user()->account;
|
||||
$account = $account->with(['clients.invoices.invoice_items', 'clients.contacts'])->first();
|
||||
$message = '';
|
||||
|
||||
$account = $account->hideFieldsForViz();
|
||||
$clients = $account->clients;
|
||||
//dd($clients->toJson());
|
||||
if (Auth::user()->account->isPro()) {
|
||||
$account = Auth::user()->account;
|
||||
$account = $account->with(['clients.invoices.invoice_items', 'clients.contacts'])->first();
|
||||
$account = $account->hideFieldsForViz();
|
||||
$clients = $account->clients->toJson();
|
||||
} else if (isset($_ENV['DATA_VIZ_SAMPLE'])) {
|
||||
$clients = $_ENV['DATA_VIZ_SAMPLE'];
|
||||
$message = trans('texts.sample_data');
|
||||
} else {
|
||||
$clients = '[]';
|
||||
}
|
||||
|
||||
$data = [
|
||||
'feature' => ACCOUNT_DATA_VISUALIZER,
|
||||
'clients' => $clients
|
||||
'feature' => ACCOUNT_DATA_VISUALIZATIONS,
|
||||
'clients' => $clients,
|
||||
'message' => $message
|
||||
];
|
||||
|
||||
return View::make('reports.d3', $data);
|
||||
|
@ -420,6 +420,7 @@ return array(
|
||||
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||
'go_back' => 'Go Back',
|
||||
|
||||
'data_visualizer' => 'Data Visualizer',
|
||||
|
||||
'data_visualizations' => 'Data Visualizations',
|
||||
'sample_data' => 'Sample data shown',
|
||||
|
||||
);
|
||||
|
@ -428,6 +428,8 @@ return array(
|
||||
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||
'go_back' => 'Go Back',
|
||||
|
||||
'data_visualizer' => 'Data Visualizer',
|
||||
|
||||
'data_visualizations' => 'Data Visualizations',
|
||||
'sample_data' => 'Sample data shown',
|
||||
|
||||
|
||||
);
|
@ -418,6 +418,7 @@ return array(
|
||||
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||
'go_back' => 'Go Back',
|
||||
|
||||
'data_visualizer' => 'Data Visualizer',
|
||||
|
||||
'data_visualizations' => 'Data Visualizations',
|
||||
'sample_data' => 'Sample data shown',
|
||||
|
||||
);
|
||||
|
@ -420,6 +420,8 @@ return array(
|
||||
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||
'go_back' => 'Go Back',
|
||||
|
||||
'data_visualizer' => 'Data Visualizer',
|
||||
'data_visualizations' => 'Data Visualizations',
|
||||
'sample_data' => 'Sample data shown',
|
||||
|
||||
|
||||
);
|
||||
|
@ -420,5 +420,7 @@ return array(
|
||||
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||
'go_back' => 'Go Back',
|
||||
|
||||
'data_visualizer' => 'Data Visualizer',
|
||||
'data_visualizations' => 'Data Visualizations',
|
||||
'sample_data' => 'Sample data shown',
|
||||
|
||||
);
|
||||
|
@ -428,7 +428,9 @@ return array(
|
||||
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||
'go_back' => 'Go Back',
|
||||
|
||||
'data_visualizer' => 'Data Visualizer',
|
||||
'data_visualizations' => 'Data Visualizations',
|
||||
'sample_data' => 'Sample data shown',
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
@ -428,6 +428,8 @@ return array(
|
||||
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||
'go_back' => 'Go Back',
|
||||
|
||||
'data_visualizer' => 'Data Visualizer',
|
||||
'data_visualizations' => 'Data Visualizations',
|
||||
'sample_data' => 'Sample data shown',
|
||||
|
||||
|
||||
);
|
@ -421,6 +421,8 @@ return array(
|
||||
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||
'go_back' => 'Go Back',
|
||||
|
||||
'data_visualizer' => 'Data Visualizer',
|
||||
'data_visualizations' => 'Data Visualizations',
|
||||
'sample_data' => 'Sample data shown',
|
||||
|
||||
|
||||
);
|
||||
|
@ -409,6 +409,8 @@ return array(
|
||||
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||
'go_back' => 'Go Back',
|
||||
|
||||
'data_visualizer' => 'Data Visualizer',
|
||||
'data_visualizations' => 'Data Visualizations',
|
||||
'sample_data' => 'Sample data shown',
|
||||
|
||||
|
||||
);
|
||||
|
@ -258,6 +258,7 @@ class Account extends Eloquent
|
||||
foreach ($this->clients as $client)
|
||||
{
|
||||
$client->setVisible([
|
||||
'public_id',
|
||||
'name',
|
||||
'balance',
|
||||
'paid_to_date',
|
||||
@ -268,6 +269,7 @@ class Account extends Eloquent
|
||||
foreach ($client->invoices as $invoice)
|
||||
{
|
||||
$invoice->setVisible([
|
||||
'public_id',
|
||||
'invoice_number',
|
||||
'amount',
|
||||
'balance',
|
||||
|
@ -80,7 +80,7 @@ Route::group(array('before' => 'auth'), function()
|
||||
Route::resource('products', 'ProductController');
|
||||
Route::get('products/{product_id}/archive', 'ProductController@archive');
|
||||
|
||||
Route::get('company/advanced_settings/data_visualizer', 'ReportController@d3');
|
||||
Route::get('company/advanced_settings/data_visualizations', 'ReportController@d3');
|
||||
Route::get('company/advanced_settings/chart_builder', 'ReportController@report');
|
||||
Route::post('company/advanced_settings/chart_builder', 'ReportController@report');
|
||||
|
||||
@ -171,7 +171,7 @@ define('ACCOUNT_CUSTOM_FIELDS', 'custom_fields');
|
||||
define('ACCOUNT_INVOICE_DESIGN', 'invoice_design');
|
||||
define('ACCOUNT_CHART_BUILDER', 'chart_builder');
|
||||
define('ACCOUNT_USER_MANAGEMENT', 'user_management');
|
||||
define('ACCOUNT_DATA_VISUALIZER', 'data_visualizer');
|
||||
define('ACCOUNT_DATA_VISUALIZATIONS', 'data_visualizations');
|
||||
|
||||
define('DEFAULT_INVOICE_NUMBER', '0001');
|
||||
define('RECENTLY_VIEWED_LIMIT', 8);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<ul class="nav nav-tabs nav nav-justified">
|
||||
{{ HTML::nav_link('company/advanced_settings/custom_fields', 'custom_fields') }}
|
||||
{{ HTML::nav_link('company/advanced_settings/invoice_design', 'invoice_design') }}
|
||||
{{ HTML::nav_link('company/advanced_settings/data_visualizer', 'data_visualizer') }}
|
||||
{{ HTML::nav_link('company/advanced_settings/data_visualizations', 'data_visualizations') }}
|
||||
{{ HTML::nav_link('company/advanced_settings/chart_builder', 'chart_builder') }}
|
||||
{{ HTML::nav_link('company/advanced_settings/user_management', 'user_management') }}
|
||||
</ul>
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="cell">Multi-user support</div>
|
||||
<div class="cell">Quotes/pro-forma invoices</div>
|
||||
<div class="cell">Custom invoice fields and colors</div>
|
||||
<div class="cell">Dynamic chart builder</div>
|
||||
<div class="cell">Dynamic data vizualizations</div>
|
||||
<div class="cell">Priority email support</div>
|
||||
<div class="cell">Remove "Created by Invoice Ninja"</div>
|
||||
<div class="cell">Latest and greatest features</div>
|
||||
@ -29,7 +29,7 @@
|
||||
<div class="cell"><div class="hide-desktop">Multi-user support</div><span class="glyphicon glyphicon-remove"></div>
|
||||
<div class="cell"><div class="hide-desktop">Quotes/pro-forma invoices</div><span class="glyphicon glyphicon-remove"></div>
|
||||
<div class="cell"><div class="hide-desktop">Custom fields and invoice colors</div><span class="glyphicon glyphicon-remove"></div>
|
||||
<div class="cell"><div class="hide-desktop">Dynamic chart builder</div><span class="glyphicon glyphicon-remove"></div>
|
||||
<div class="cell"><div class="hide-desktop">Dynamic data vizualizations</div><span class="glyphicon glyphicon-remove"></div>
|
||||
<div class="cell"><div class="hide-desktop">Priority email support</div><span class="glyphicon glyphicon-remove"></div>
|
||||
<div class="cell"><div class="hide-desktop">Remove "Created by Invoice Ninja"</div><span class="glyphicon glyphicon-remove"></div>
|
||||
<div class="cell"><div class="hide-desktop">Latest and greatest features</div><span class="glyphicon glyphicon-remove"></div>
|
||||
@ -47,7 +47,7 @@
|
||||
<div class="cell"><div class="hide-desktop">Multi-user support</div><span class="glyphicon glyphicon-ok"></div>
|
||||
<div class="cell"><div class="hide-desktop">Quotes/pro-forma invoices</div><span class="glyphicon glyphicon-ok"></div>
|
||||
<div class="cell"><div class="hide-desktop">Custom invoice fields and colors</div><span class="glyphicon glyphicon-ok"></div>
|
||||
<div class="cell"><div class="hide-desktop">Dynamic chart builder</div><span class="glyphicon glyphicon-ok"></div>
|
||||
<div class="cell"><div class="hide-desktop">Dynamic data vizualizations</div><span class="glyphicon glyphicon-ok"></div>
|
||||
<div class="cell"><div class="hide-desktop">Priority email support</div><span class="glyphicon glyphicon-ok"></div>
|
||||
<div class="cell"><div class="hide-desktop">Remove "Created by Invoice Ninja"</div><span class="glyphicon glyphicon-ok"></div>
|
||||
<div class="cell"><div class="hide-desktop">Latest and greatest features</div><span class="glyphicon glyphicon-ok"></div>
|
||||
|
@ -32,6 +32,10 @@
|
||||
@parent
|
||||
@include('accounts.nav_advanced')
|
||||
|
||||
{{ Former::open() }}
|
||||
{{ Former::legend('data_visualizations') }}
|
||||
{{ Former::close() }}
|
||||
|
||||
<div id="tooltip" class="hidden">
|
||||
<p>
|
||||
<strong><span id="tooltipTitle"></span></strong>
|
||||
@ -49,7 +53,7 @@
|
||||
<option>Invoices</option>
|
||||
<option>Products</option>
|
||||
</select>
|
||||
|
||||
{{ $message }}
|
||||
</form>
|
||||
|
||||
<p> </p>
|
||||
@ -59,7 +63,7 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
// store data as JSON
|
||||
var data = {{ $clients->toJson() }};
|
||||
var data = {{ $clients }};
|
||||
|
||||
_.each(data, function(client) {
|
||||
_.each(client.invoices, function(invoice) {
|
||||
@ -73,12 +77,10 @@
|
||||
var clients = data.concat();
|
||||
var invoices = _.flatten(_.pluck(clients, 'invoices'));
|
||||
|
||||
/*
|
||||
// remove quotes and recurring invoices
|
||||
invoices = _.filter(invoices, function(invoice) {
|
||||
return !parseInt(invoice.is_quote) && !parseInt(invoice.is_recurring);
|
||||
});
|
||||
*/
|
||||
|
||||
var products = _.flatten(_.pluck(invoices, 'invoice_items'));
|
||||
products = d3.nest()
|
||||
@ -210,7 +212,7 @@
|
||||
d3.select("#tooltipBalance").text(formatMoney(d.displayBalance));
|
||||
d3.select("#tooltipAge").text(pluralize('? day', parseInt(d.displayAge)));
|
||||
|
||||
if (groupBy == "products") {
|
||||
if (groupBy == "products" || !d.public_id) {
|
||||
d3.select("#tooltip a").classed("hidden", true);
|
||||
} else {
|
||||
d3.select("#tooltip a").classed("hidden", false);
|
||||
@ -259,7 +261,6 @@
|
||||
.duration(1000)
|
||||
.style("fill", function(d, i) {
|
||||
return d.displayAge ? color(d.displayAge) : 'grey';
|
||||
//return 'red';
|
||||
});
|
||||
|
||||
selection.exit().remove();
|
||||
|
@ -10,6 +10,10 @@
|
||||
@parent
|
||||
@include('accounts.nav_advanced')
|
||||
|
||||
{{ Former::open() }}
|
||||
{{ Former::legend('chart_builder') }}
|
||||
{{ Former::close() }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user