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);

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

@ -163,7 +163,7 @@ 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);