mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04: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.
|
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
|
### Features
|
||||||
|
|
||||||
@ -27,6 +27,8 @@ Site design by [kantorp-wegl.in](http://kantorp-wegl.in/)
|
|||||||
* Recurring invoices
|
* Recurring invoices
|
||||||
* Tax rates and payment terms
|
* Tax rates and payment terms
|
||||||
* Multi-user support
|
* Multi-user support
|
||||||
|
* [Zapier](https://zapier.com/) integration
|
||||||
|
* [D3.js](http://d3js.org/) visualizations
|
||||||
|
|
||||||
### Steps to setup
|
### Steps to setup
|
||||||
|
|
||||||
|
@ -4,16 +4,24 @@ class ReportController extends \BaseController {
|
|||||||
|
|
||||||
public function d3()
|
public function d3()
|
||||||
{
|
{
|
||||||
|
$message = '';
|
||||||
|
|
||||||
|
if (Auth::user()->account->isPro()) {
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
$account = $account->with(['clients.invoices.invoice_items', 'clients.contacts'])->first();
|
$account = $account->with(['clients.invoices.invoice_items', 'clients.contacts'])->first();
|
||||||
|
|
||||||
$account = $account->hideFieldsForViz();
|
$account = $account->hideFieldsForViz();
|
||||||
$clients = $account->clients;
|
$clients = $account->clients->toJson();
|
||||||
//dd($clients->toJson());
|
} else if (isset($_ENV['DATA_VIZ_SAMPLE'])) {
|
||||||
|
$clients = $_ENV['DATA_VIZ_SAMPLE'];
|
||||||
|
$message = trans('texts.sample_data');
|
||||||
|
} else {
|
||||||
|
$clients = '[]';
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'feature' => ACCOUNT_DATA_VISUALIZER,
|
'feature' => ACCOUNT_DATA_VISUALIZATIONS,
|
||||||
'clients' => $clients
|
'clients' => $clients,
|
||||||
|
'message' => $message
|
||||||
];
|
];
|
||||||
|
|
||||||
return View::make('reports.d3', $data);
|
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.',
|
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||||
'go_back' => 'Go Back',
|
'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.',
|
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||||
'go_back' => 'Go Back',
|
'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.',
|
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||||
'go_back' => 'Go Back',
|
'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.',
|
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||||
'go_back' => 'Go Back',
|
'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.',
|
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||||
'go_back' => 'Go Back',
|
'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.',
|
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||||
'go_back' => 'Go Back',
|
'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.',
|
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||||
'go_back' => 'Go Back',
|
'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.',
|
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||||
'go_back' => 'Go Back',
|
'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.',
|
'cancel_account_message' => 'Warning: This will permanently erase all of your data, there is no undo.',
|
||||||
'go_back' => 'Go Back',
|
'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)
|
foreach ($this->clients as $client)
|
||||||
{
|
{
|
||||||
$client->setVisible([
|
$client->setVisible([
|
||||||
|
'public_id',
|
||||||
'name',
|
'name',
|
||||||
'balance',
|
'balance',
|
||||||
'paid_to_date',
|
'paid_to_date',
|
||||||
@ -268,6 +269,7 @@ class Account extends Eloquent
|
|||||||
foreach ($client->invoices as $invoice)
|
foreach ($client->invoices as $invoice)
|
||||||
{
|
{
|
||||||
$invoice->setVisible([
|
$invoice->setVisible([
|
||||||
|
'public_id',
|
||||||
'invoice_number',
|
'invoice_number',
|
||||||
'amount',
|
'amount',
|
||||||
'balance',
|
'balance',
|
||||||
|
@ -80,7 +80,7 @@ Route::group(array('before' => 'auth'), function()
|
|||||||
Route::resource('products', 'ProductController');
|
Route::resource('products', 'ProductController');
|
||||||
Route::get('products/{product_id}/archive', 'ProductController@archive');
|
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::get('company/advanced_settings/chart_builder', 'ReportController@report');
|
||||||
Route::post('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_INVOICE_DESIGN', 'invoice_design');
|
||||||
define('ACCOUNT_CHART_BUILDER', 'chart_builder');
|
define('ACCOUNT_CHART_BUILDER', 'chart_builder');
|
||||||
define('ACCOUNT_USER_MANAGEMENT', 'user_management');
|
define('ACCOUNT_USER_MANAGEMENT', 'user_management');
|
||||||
define('ACCOUNT_DATA_VISUALIZER', 'data_visualizer');
|
define('ACCOUNT_DATA_VISUALIZATIONS', 'data_visualizations');
|
||||||
|
|
||||||
define('DEFAULT_INVOICE_NUMBER', '0001');
|
define('DEFAULT_INVOICE_NUMBER', '0001');
|
||||||
define('RECENTLY_VIEWED_LIMIT', 8);
|
define('RECENTLY_VIEWED_LIMIT', 8);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<ul class="nav nav-tabs nav nav-justified">
|
<ul class="nav nav-tabs nav nav-justified">
|
||||||
{{ HTML::nav_link('company/advanced_settings/custom_fields', 'custom_fields') }}
|
{{ 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/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/chart_builder', 'chart_builder') }}
|
||||||
{{ HTML::nav_link('company/advanced_settings/user_management', 'user_management') }}
|
{{ HTML::nav_link('company/advanced_settings/user_management', 'user_management') }}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<div class="cell">Multi-user support</div>
|
<div class="cell">Multi-user support</div>
|
||||||
<div class="cell">Quotes/pro-forma invoices</div>
|
<div class="cell">Quotes/pro-forma invoices</div>
|
||||||
<div class="cell">Custom invoice fields and colors</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">Priority email support</div>
|
||||||
<div class="cell">Remove "Created by Invoice Ninja"</div>
|
<div class="cell">Remove "Created by Invoice Ninja"</div>
|
||||||
<div class="cell">Latest and greatest features</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">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">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">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">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">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>
|
<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">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">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">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">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">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>
|
<div class="cell"><div class="hide-desktop">Latest and greatest features</div><span class="glyphicon glyphicon-ok"></div>
|
||||||
|
@ -32,6 +32,10 @@
|
|||||||
@parent
|
@parent
|
||||||
@include('accounts.nav_advanced')
|
@include('accounts.nav_advanced')
|
||||||
|
|
||||||
|
{{ Former::open() }}
|
||||||
|
{{ Former::legend('data_visualizations') }}
|
||||||
|
{{ Former::close() }}
|
||||||
|
|
||||||
<div id="tooltip" class="hidden">
|
<div id="tooltip" class="hidden">
|
||||||
<p>
|
<p>
|
||||||
<strong><span id="tooltipTitle"></span></strong>
|
<strong><span id="tooltipTitle"></span></strong>
|
||||||
@ -49,7 +53,7 @@
|
|||||||
<option>Invoices</option>
|
<option>Invoices</option>
|
||||||
<option>Products</option>
|
<option>Products</option>
|
||||||
</select>
|
</select>
|
||||||
|
{{ $message }}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p> </p>
|
<p> </p>
|
||||||
@ -59,7 +63,7 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
// store data as JSON
|
// store data as JSON
|
||||||
var data = {{ $clients->toJson() }};
|
var data = {{ $clients }};
|
||||||
|
|
||||||
_.each(data, function(client) {
|
_.each(data, function(client) {
|
||||||
_.each(client.invoices, function(invoice) {
|
_.each(client.invoices, function(invoice) {
|
||||||
@ -73,12 +77,10 @@
|
|||||||
var clients = data.concat();
|
var clients = data.concat();
|
||||||
var invoices = _.flatten(_.pluck(clients, 'invoices'));
|
var invoices = _.flatten(_.pluck(clients, 'invoices'));
|
||||||
|
|
||||||
/*
|
|
||||||
// remove quotes and recurring invoices
|
// remove quotes and recurring invoices
|
||||||
invoices = _.filter(invoices, function(invoice) {
|
invoices = _.filter(invoices, function(invoice) {
|
||||||
return !parseInt(invoice.is_quote) && !parseInt(invoice.is_recurring);
|
return !parseInt(invoice.is_quote) && !parseInt(invoice.is_recurring);
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
|
|
||||||
var products = _.flatten(_.pluck(invoices, 'invoice_items'));
|
var products = _.flatten(_.pluck(invoices, 'invoice_items'));
|
||||||
products = d3.nest()
|
products = d3.nest()
|
||||||
@ -210,7 +212,7 @@
|
|||||||
d3.select("#tooltipBalance").text(formatMoney(d.displayBalance));
|
d3.select("#tooltipBalance").text(formatMoney(d.displayBalance));
|
||||||
d3.select("#tooltipAge").text(pluralize('? day', parseInt(d.displayAge)));
|
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);
|
d3.select("#tooltip a").classed("hidden", true);
|
||||||
} else {
|
} else {
|
||||||
d3.select("#tooltip a").classed("hidden", false);
|
d3.select("#tooltip a").classed("hidden", false);
|
||||||
@ -259,7 +261,6 @@
|
|||||||
.duration(1000)
|
.duration(1000)
|
||||||
.style("fill", function(d, i) {
|
.style("fill", function(d, i) {
|
||||||
return d.displayAge ? color(d.displayAge) : 'grey';
|
return d.displayAge ? color(d.displayAge) : 'grey';
|
||||||
//return 'red';
|
|
||||||
});
|
});
|
||||||
|
|
||||||
selection.exit().remove();
|
selection.exit().remove();
|
||||||
|
@ -10,6 +10,10 @@
|
|||||||
@parent
|
@parent
|
||||||
@include('accounts.nav_advanced')
|
@include('accounts.nav_advanced')
|
||||||
|
|
||||||
|
{{ Former::open() }}
|
||||||
|
{{ Former::legend('chart_builder') }}
|
||||||
|
{{ Former::close() }}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user