Working on the dashboard

This commit is contained in:
Hillel Coren 2016-09-11 20:05:59 +03:00
parent ce3a510037
commit ef81549694
7 changed files with 19 additions and 20 deletions

View File

@ -22,10 +22,6 @@ class DuplicateSubmissionCheck
$path = $request->path(); $path = $request->path();
if (strpos($path, 'charts_and_reports') !== false) {
return $next($request);
}
if (in_array($request->method(), ['POST', 'PUT', 'DELETE'])) { if (in_array($request->method(), ['POST', 'PUT', 'DELETE'])) {
$lastPage = session(SESSION_LAST_REQUEST_PAGE); $lastPage = session(SESSION_LAST_REQUEST_PAGE);
$lastTime = session(SESSION_LAST_REQUEST_TIME); $lastTime = session(SESSION_LAST_REQUEST_TIME);
@ -40,4 +36,4 @@ class DuplicateSubmissionCheck
return $next($request); return $next($request);
} }
} }

View File

@ -111,8 +111,8 @@ class DashboardRepository
$timeframe = 'concat(YEAR('.$entityType.'_date), '.$groupBy.'('.$entityType.'_date))'; $timeframe = 'concat(YEAR('.$entityType.'_date), '.$groupBy.'('.$entityType.'_date))';
$records = DB::table($entityType.'s') $records = DB::table($entityType.'s')
->join('clients', 'clients.id', '=', $entityType.'s.client_id') ->leftJoin('clients', 'clients.id', '=', $entityType.'s.client_id')
->where('clients.is_deleted', '=', false) ->whereRaw('(clients.id IS NULL OR clients.is_deleted = 0)')
->where($entityType.'s.account_id', '=', $accountId) ->where($entityType.'s.account_id', '=', $accountId)
->where($entityType.'s.is_deleted', '=', false) ->where($entityType.'s.is_deleted', '=', false)
->where($entityType.'s.'.$entityType.'_date', '>=', $startDate->format('Y-m-d')) ->where($entityType.'s.'.$entityType.'_date', '>=', $startDate->format('Y-m-d'))
@ -320,13 +320,14 @@ class DashboardRepository
->where('invoices.is_deleted', '=', false) ->where('invoices.is_deleted', '=', false)
->where('clients.is_deleted', '=', false) ->where('clients.is_deleted', '=', false)
->where('contacts.deleted_at', '=', null) ->where('contacts.deleted_at', '=', null)
->where('contacts.is_primary', '=', true); ->where('contacts.is_primary', '=', true)
->whereNotIn('payments.payment_status_id', [PAYMENT_STATUS_VOIDED, PAYMENT_STATUS_FAILED]);
if (!$viewAll){ if (!$viewAll){
$payments = $payments->where('payments.user_id', '=', $userId); $payments = $payments->where('payments.user_id', '=', $userId);
} }
return $payments->select(['payments.payment_date', 'payments.amount', 'invoices.public_id', 'invoices.invoice_number', 'clients.name as client_name', 'contacts.email', 'contacts.first_name', 'contacts.last_name', 'clients.currency_id', 'clients.public_id as client_public_id', 'clients.user_id as client_user_id']) return $payments->select(['payments.payment_date', DB::raw('(payments.amount - payments.refunded) as amount'), 'invoices.public_id', 'invoices.invoice_number', 'clients.name as client_name', 'contacts.email', 'contacts.first_name', 'contacts.last_name', 'clients.currency_id', 'clients.public_id as client_public_id', 'clients.user_id as client_user_id'])
->orderBy('payments.payment_date', 'desc') ->orderBy('payments.payment_date', 'desc')
->take(50) ->take(50)
->get(); ->get();

View File

@ -31,7 +31,7 @@ Want to find out everything there is to know about how to use your Invoice Ninja
email_settings email_settings
templates_and_reminders templates_and_reminders
client_portal client_portal
charts_and_reports reports
data_visualizations data_visualizations
api_tokens api_tokens
user_management user_management

View File

@ -22,6 +22,7 @@
if (window.myChart) { if (window.myChart) {
window.myChart.config.data = data; window.myChart.config.data = data;
window.myChart.config.options.scales.xAxes[0].time.unit = chartGropuBy.toLowerCase(); window.myChart.config.options.scales.xAxes[0].time.unit = chartGropuBy.toLowerCase();
window.myChart.config.options.scales.xAxes[0].time.round = chartGropuBy.toLowerCase();
window.myChart.update(); window.myChart.update();
} else { } else {
$('#progress-div').hide(); $('#progress-div').hide();
@ -63,6 +64,7 @@
type: 'time', type: 'time',
time: { time: {
unit: 'day', unit: 'day',
round: 'day',
}, },
gridLines: { gridLines: {
display: false, display: false,

View File

@ -81,8 +81,8 @@ $I->see('Invoice Design');
$I->amOnPage('/settings/templates_and_reminders'); $I->amOnPage('/settings/templates_and_reminders');
$I->see('Invoice Email'); $I->see('Invoice Email');
$I->amOnPage('/settings/charts_and_reports'); $I->amOnPage('/settings/reports');
$I->see('Data Visualizations'); $I->see('Report Settings');
//try to logout //try to logout
//$I->click('#myAccountButton'); //$I->click('#myAccountButton');

View File

@ -36,7 +36,7 @@ class SettingsCest
$I->seeRecord('accounts', array('name' => $name)); $I->seeRecord('accounts', array('name' => $name));
} }
*/ */
public function userDetails(FunctionalTester $I) public function userDetails(FunctionalTester $I)
{ {
$I->wantTo('update the user details'); $I->wantTo('update the user details');
@ -96,7 +96,7 @@ class SettingsCest
$I->seeRecord('products', array('product_key' => $productKey)); $I->seeRecord('products', array('product_key' => $productKey));
} }
public function updateProduct(FunctionalTester $I) public function updateProduct(FunctionalTester $I)
{ {
return; return;
@ -128,7 +128,7 @@ class SettingsCest
$I->seeRecord('accounts', array('invoice_terms' => $terms)); $I->seeRecord('accounts', array('invoice_terms' => $terms));
} }
*/ */
public function updateInvoiceSettings(FunctionalTester $I) public function updateInvoiceSettings(FunctionalTester $I)
{ {
$I->wantTo('update invoice settings'); $I->wantTo('update invoice settings');
@ -163,12 +163,12 @@ class SettingsCest
public function runReport(FunctionalTester $I) public function runReport(FunctionalTester $I)
{ {
$I->wantTo('run the report'); $I->wantTo('run the report');
$I->amOnPage('/settings/charts_and_reports'); $I->amOnPage('/settings/reports');
$I->click('Run'); $I->click('Run');
$I->seeResponseCodeIs(200); $I->seeResponseCodeIs(200);
} }
public function createUser(FunctionalTester $I) public function createUser(FunctionalTester $I)
{ {
$I->wantTo('create a user'); $I->wantTo('create a user');
@ -213,7 +213,7 @@ class SettingsCest
$I->fillField(['name' => '23_apiKey'], $apiKey); $I->fillField(['name' => '23_apiKey'], $apiKey);
$I->click('Save'); $I->click('Save');
$I->seeResponseCodeIs(200); $I->seeResponseCodeIs(200);
$I->see('Successfully created gateway'); $I->see('Successfully created gateway');
$I->seeRecord('account_gateways', array('gateway_id' => 23)); $I->seeRecord('account_gateways', array('gateway_id' => 23));
@ -224,12 +224,12 @@ class SettingsCest
// $I->amOnPage('/gateways/1/edit'); // $I->amOnPage('/gateways/1/edit');
// $I->click('Save'); // $I->click('Save');
// $I->seeResponseCodeIs(200); // $I->seeResponseCodeIs(200);
// $I->see('Successfully updated gateway'); // $I->see('Successfully updated gateway');
// $I->seeRecord('account_gateways', array('config' => '{"apiKey":"ASHHOWAH"}')); // $I->seeRecord('account_gateways', array('config' => '{"apiKey":"ASHHOWAH"}'));
} }
*/ */
} }