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

View File

@ -111,8 +111,8 @@ class DashboardRepository
$timeframe = 'concat(YEAR('.$entityType.'_date), '.$groupBy.'('.$entityType.'_date))';
$records = DB::table($entityType.'s')
->join('clients', 'clients.id', '=', $entityType.'s.client_id')
->where('clients.is_deleted', '=', false)
->leftJoin('clients', 'clients.id', '=', $entityType.'s.client_id')
->whereRaw('(clients.id IS NULL OR clients.is_deleted = 0)')
->where($entityType.'s.account_id', '=', $accountId)
->where($entityType.'s.is_deleted', '=', false)
->where($entityType.'s.'.$entityType.'_date', '>=', $startDate->format('Y-m-d'))
@ -320,13 +320,14 @@ class DashboardRepository
->where('invoices.is_deleted', '=', false)
->where('clients.is_deleted', '=', false)
->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){
$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')
->take(50)
->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
templates_and_reminders
client_portal
charts_and_reports
reports
data_visualizations
api_tokens
user_management

View File

@ -22,6 +22,7 @@
if (window.myChart) {
window.myChart.config.data = data;
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();
} else {
$('#progress-div').hide();
@ -63,6 +64,7 @@
type: 'time',
time: {
unit: 'day',
round: 'day',
},
gridLines: {
display: false,

View File

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

View File

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