1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Working on statements

This commit is contained in:
Hillel Coren 2018-04-30 20:14:50 +03:00
parent b501e971ef
commit 2e9f912b0b
4 changed files with 57 additions and 16 deletions

View File

@ -1009,4 +1009,42 @@ class ClientPortalController extends BaseController
return redirect($account->enable_client_portal_dashboard ? '/client/dashboard' : '/client/payment_methods')
->withMessage(trans('texts.updated_client_details'));
}
public function statement() {
if (! $contact = $this->getContact()) {
return $this->returnError();
}
$client = $contact->client;
$account = $contact->account;
if (! $account->enable_client_portal || ! $account->enable_client_portal_dashboard) {
return $this->returnError();
}
$statusId = request()->status_id;
$startDate = request()->start_date;
$endDate = request()->end_date;
$account = auth()->user()->account;
if (! $startDate) {
$startDate = Utils::today(false)->modify('-6 month')->format('Y-m-d');
$endDate = Utils::today(false)->format('Y-m-d');
}
if (request()->json) {
return dispatch(new GenerateStatementData($client, request()->all()));
}
$data = [
'extends' => 'public.header',
'client' => $client,
'account' => $account,
'startDate' => $startDate,
'endDate' => $endDate,
];
return view('clients.statement', $data);
}
}

View File

@ -1,4 +1,4 @@
@extends('header')
@extends(! empty($extends) ? $extends : 'header')
@section('head')
@parent
@ -130,21 +130,23 @@
@section('content')
<div class="pull-right">
{!! Button::normal(trans('texts.download'))
->withAttributes(['onclick' => 'onDownloadClick()'])
->appendIcon(Icon::create('download-alt')) !!}
{!! Button::primary(trans('texts.view_client'))
->asLinkTo($client->present()->url) !!}
</div>
@if (empty($extends))
<div class="pull-right">
{!! Button::normal(trans('texts.download'))
->withAttributes(['onclick' => 'onDownloadClick()'])
->appendIcon(Icon::create('download-alt')) !!}
{!! Button::primary(trans('texts.view_client'))
->asLinkTo($client->present()->url) !!}
</div>
<ol class="breadcrumb pull-left">
<li>{{ link_to('/clients', trans('texts.clients')) }}</li>
<li class='active'>{{ $client->getDisplayName() }}</li>
</ol>
<ol class="breadcrumb pull-left">
<li>{{ link_to('/clients', trans('texts.clients')) }}</li>
<li class='active'>{{ $client->getDisplayName() }}</li>
</ol>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
@endif
<div class="well" style="background: #eeeeee">
{!! Former::inline_open()->onchange('refreshData()') !!}
@ -189,6 +191,6 @@
{!! Former::close() !!}
</div>
@include('invoices.pdf', ['account' => Auth::user()->account, 'pdfHeight' => 800])
@include('invoices.pdf', ['account' => Auth::user()->account])
@stop

View File

@ -154,7 +154,7 @@
</div>
</div>
<div id="mainContent">
<div id="mainContent" class="container">
@yield('content')
</div>

View File

@ -28,6 +28,7 @@ Route::group(['middleware' => ['lookup:contact', 'auth:client']], function () {
Route::match(['GET', 'POST'], 'complete/{invitation_key?}/{gateway_type?}', 'OnlinePaymentController@offsitePayment');
Route::get('bank/{routing_number}', 'OnlinePaymentController@getBankInfo');
Route::get('client/payment_methods', 'ClientPortalController@paymentMethods');
Route::get('client/statement', 'ClientPortalController@statement');
Route::post('client/payment_methods/verify', 'ClientPortalController@verifyPaymentMethod');
Route::post('client/payment_methods/default', 'ClientPortalController@setDefaultPaymentMethod');
Route::post('client/payment_methods/{source_id}/remove', 'ClientPortalController@removePaymentMethod');