mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 22:54:25 +01:00
Always show recurring invoices in client portal
This commit is contained in:
parent
78f87f5911
commit
4ed8468195
@ -326,14 +326,20 @@ class ClientPortalController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$color = $account->primary_color ? $account->primary_color : '#0b4d78';
|
$color = $account->primary_color ? $account->primary_color : '#0b4d78';
|
||||||
|
$columns = ['frequency', 'start_date', 'end_date', 'invoice_total'];
|
||||||
|
$client = $contact->client;
|
||||||
|
|
||||||
|
if ($client->hasAutoBillConfigurableInvoices()) {
|
||||||
|
$columns[] = 'auto_bill';
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'color' => $color,
|
'color' => $color,
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
'client' => $contact->client,
|
'client' => $client,
|
||||||
'title' => trans('texts.recurring_invoices'),
|
'title' => trans('texts.recurring_invoices'),
|
||||||
'entityType' => ENTITY_RECURRING_INVOICE,
|
'entityType' => ENTITY_RECURRING_INVOICE,
|
||||||
'columns' => Utils::trans(['frequency', 'start_date', 'end_date', 'invoice_total', 'auto_bill']),
|
'columns' => Utils::trans($columns),
|
||||||
];
|
];
|
||||||
|
|
||||||
return response()->view('public_list', $data);
|
return response()->view('public_list', $data);
|
||||||
|
@ -543,7 +543,15 @@ class Client extends EntityModel
|
|||||||
*/
|
*/
|
||||||
public function hasAutoBillConfigurableInvoices()
|
public function hasAutoBillConfigurableInvoices()
|
||||||
{
|
{
|
||||||
return $this->invoices()->whereIn('auto_bill', [AUTO_BILL_OPT_IN, AUTO_BILL_OPT_OUT])->count() > 0;
|
return $this->invoices()->whereIsPublic(true)->whereIn('auto_bill', [AUTO_BILL_OPT_IN, AUTO_BILL_OPT_OUT])->count() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function hasRecurringInvoices()
|
||||||
|
{
|
||||||
|
return $this->invoices()->whereIsPublic(true)->whereIsRecurring(true)->count() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function defaultDaysDue()
|
public function defaultDaysDue()
|
||||||
|
@ -211,7 +211,6 @@ class InvoiceRepository extends BaseRepository
|
|||||||
->where('clients.deleted_at', '=', null)
|
->where('clients.deleted_at', '=', null)
|
||||||
->where('invoices.is_recurring', '=', true)
|
->where('invoices.is_recurring', '=', true)
|
||||||
->where('invoices.is_public', '=', true)
|
->where('invoices.is_public', '=', true)
|
||||||
->whereIn('invoices.auto_bill', [AUTO_BILL_OPT_IN, AUTO_BILL_OPT_OUT])
|
|
||||||
//->where('invoices.start_date', '>=', date('Y-m-d H:i:s'))
|
//->where('invoices.start_date', '>=', date('Y-m-d H:i:s'))
|
||||||
->select(
|
->select(
|
||||||
DB::raw('COALESCE(clients.currency_id, accounts.currency_id) currency_id'),
|
DB::raw('COALESCE(clients.currency_id, accounts.currency_id) currency_id'),
|
||||||
@ -225,6 +224,7 @@ class InvoiceRepository extends BaseRepository
|
|||||||
'invoices.amount',
|
'invoices.amount',
|
||||||
'invoices.start_date',
|
'invoices.start_date',
|
||||||
'invoices.end_date',
|
'invoices.end_date',
|
||||||
|
'invoices.auto_bill',
|
||||||
'invoices.client_enable_auto_bill',
|
'invoices.client_enable_auto_bill',
|
||||||
'frequencies.name as frequency'
|
'frequencies.name as frequency'
|
||||||
);
|
);
|
||||||
@ -243,7 +243,11 @@ class InvoiceRepository extends BaseRepository
|
|||||||
return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id);
|
return Utils::formatMoney($model->amount, $model->currency_id, $model->country_id);
|
||||||
})
|
})
|
||||||
->addColumn('client_enable_auto_bill', function ($model) {
|
->addColumn('client_enable_auto_bill', function ($model) {
|
||||||
if ($model->client_enable_auto_bill) {
|
if ($model->auto_bill == AUTO_BILL_OFF) {
|
||||||
|
return trans('texts.disabled');
|
||||||
|
} elseif ($model->auto_bill == AUTO_BILL_ALWAYS) {
|
||||||
|
return trans('texts.enabled');
|
||||||
|
} elseif ($model->client_enable_auto_bill) {
|
||||||
return trans('texts.enabled') . ' - <a href="javascript:setAutoBill('.$model->public_id.',false)">'.trans('texts.disable').'</a>';
|
return trans('texts.enabled') . ' - <a href="javascript:setAutoBill('.$model->public_id.',false)">'.trans('texts.disable').'</a>';
|
||||||
} else {
|
} else {
|
||||||
return trans('texts.disabled') . ' - <a href="javascript:setAutoBill('.$model->public_id.',true)">'.trans('texts.enable').'</a>';
|
return trans('texts.disabled') . ' - <a href="javascript:setAutoBill('.$model->public_id.',true)">'.trans('texts.enable').'</a>';
|
||||||
|
@ -35,9 +35,9 @@
|
|||||||
</div>
|
</div>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@if($entityType == ENTITY_INVOICE && $account->getTokenGatewayId() && $client->hasAutoBillConfigurableInvoices())
|
@if($entityType == ENTITY_INVOICE && $client->hasRecurringInvoices())
|
||||||
<div class="pull-right" style="margin-top:5px">
|
<div class="pull-right" style="margin-top:5px">
|
||||||
{!! Button::info(trans("texts.manage_auto_bill"))->asLinkTo(URL::to('/client/invoices/recurring'))->appendIcon(Icon::create('repeat')) !!}
|
{!! Button::primary(trans("texts.recurring_invoices"))->asLinkTo(URL::to('/client/invoices/recurring')) !!}
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<h3>{{ $title }}</h3>
|
<h3>{{ $title }}</h3>
|
||||||
@ -49,7 +49,7 @@
|
|||||||
->render('datatable') !!}
|
->render('datatable') !!}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if($entityType == ENTITY_RECURRING_INVOICE)
|
@if ($entityType == ENTITY_RECURRING_INVOICE)
|
||||||
{!! Former::open(URL::to('/client/invoices/auto_bill'))->id('auto_bill_form') !!}
|
{!! Former::open(URL::to('/client/invoices/auto_bill'))->id('auto_bill_form') !!}
|
||||||
<input type="hidden" name="public_id" id="auto_bill_public_id">
|
<input type="hidden" name="public_id" id="auto_bill_public_id">
|
||||||
<input type="hidden" name="enable" id="auto_bill_enable">
|
<input type="hidden" name="enable" id="auto_bill_enable">
|
||||||
|
Loading…
Reference in New Issue
Block a user