mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Separated recurring invoices from invoices list
This commit is contained in:
parent
ad9d8253eb
commit
b040aad021
@ -68,9 +68,6 @@ class ClientController extends BaseController
|
||||
->addColumn('last_login', function ($model) { return Utils::timestampToDateString(strtotime($model->last_login)); })
|
||||
->addColumn('balance', function ($model) { return Utils::formatMoney($model->balance, $model->currency_id); })
|
||||
->addColumn('dropdown', function ($model) {
|
||||
if ($model->is_deleted) {
|
||||
return '<div style="height:38px"/>';
|
||||
}
|
||||
|
||||
$str = '<div class="btn-group tr-action" style="visibility:hidden;">
|
||||
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
@ -97,7 +94,11 @@ class ClientController extends BaseController
|
||||
$str .= '<li><a href="javascript:restoreEntity('.$model->public_id.')">'.trans('texts.restore_client').'</a></li>';
|
||||
}
|
||||
|
||||
return $str.'<li><a href="javascript:deleteEntity('.$model->public_id.')">'.trans('texts.delete_client').'</a></li></ul>
|
||||
if ($model->is_deleted) {
|
||||
return $str. '</ul></div>';
|
||||
}
|
||||
|
||||
return $str.'<li><a href="javascript:deleteEntity('.$model->public_id.')">'.trans('texts.delete_client').'</a></li></ul>
|
||||
</div>';
|
||||
})
|
||||
->make();
|
||||
|
@ -58,24 +58,20 @@ class InvoiceController extends BaseController
|
||||
$data = [
|
||||
'title' => trans('texts.invoices'),
|
||||
'entityType' => ENTITY_INVOICE,
|
||||
'columns' => Utils::trans(['checkbox', 'invoice_number', 'client', 'invoice_date', 'invoice_total', 'balance_due', 'due_date', 'status', 'action']),
|
||||
'columns' => Utils::trans([
|
||||
'checkbox',
|
||||
'invoice_number',
|
||||
'client',
|
||||
'invoice_date',
|
||||
'invoice_total',
|
||||
'balance_due',
|
||||
'due_date',
|
||||
'status',
|
||||
'action'
|
||||
]),
|
||||
];
|
||||
|
||||
$recurringInvoices = Invoice::scope()->where('is_recurring', '=', true);
|
||||
|
||||
if (Session::get('show_trash:invoice')) {
|
||||
$recurringInvoices->withTrashed();
|
||||
} else {
|
||||
$recurringInvoices->join('clients', 'clients.id', '=', 'invoices.client_id')
|
||||
->where('clients.deleted_at', '=', null);
|
||||
}
|
||||
|
||||
if ($recurringInvoices->count() > 0) {
|
||||
$data['secEntityType'] = ENTITY_RECURRING_INVOICE;
|
||||
$data['secColumns'] = Utils::trans(['checkbox', 'frequency', 'client', 'start_date', 'end_date', 'invoice_total', 'action']);
|
||||
}
|
||||
|
||||
return View::make('list', $data);
|
||||
return response()->view('list', $data);
|
||||
}
|
||||
|
||||
public function getDatatable($clientPublicId = null)
|
||||
|
@ -53,18 +53,19 @@ class QuoteController extends BaseController
|
||||
$data = [
|
||||
'title' => trans('texts.quotes'),
|
||||
'entityType' => ENTITY_QUOTE,
|
||||
'columns' => Utils::trans(['checkbox', 'quote_number', 'client', 'quote_date', 'quote_total', 'valid_until', 'status', 'action']),
|
||||
'columns' => Utils::trans([
|
||||
'checkbox',
|
||||
'quote_number',
|
||||
'client',
|
||||
'quote_date',
|
||||
'quote_total',
|
||||
'valid_until',
|
||||
'status',
|
||||
'action'
|
||||
]),
|
||||
];
|
||||
|
||||
/*
|
||||
if (Invoice::scope()->where('is_recurring', '=', true)->count() > 0)
|
||||
{
|
||||
$data['secEntityType'] = ENTITY_RECURRING_INVOICE;
|
||||
$data['secColumns'] = Utils::trans(['checkbox', 'frequency', 'client', 'start_date', 'end_date', 'quote_total', 'action']);
|
||||
}
|
||||
*/
|
||||
|
||||
return View::make('list', $data);
|
||||
return response()->view('list', $data);
|
||||
}
|
||||
|
||||
public function getDatatable($clientPublicId = null)
|
||||
|
36
app/Http/Controllers/RecurringInvoiceController.php
Normal file
36
app/Http/Controllers/RecurringInvoiceController.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
use Utils;
|
||||
use App\Ninja\Repositories\InvoiceRepository;
|
||||
|
||||
class RecurringInvoiceController extends BaseController
|
||||
{
|
||||
protected $invoiceRepo;
|
||||
|
||||
public function __construct(InvoiceRepository $invoiceRepo)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->invoiceRepo = $invoiceRepo;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'title' => trans('texts.recurring_invoices'),
|
||||
'entityType' => ENTITY_RECURRING_INVOICE,
|
||||
'columns' => Utils::trans([
|
||||
'checkbox',
|
||||
'frequency',
|
||||
'client',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'invoice_total',
|
||||
'action'
|
||||
])
|
||||
];
|
||||
|
||||
return response()->view('list', $data);
|
||||
}
|
||||
|
||||
}
|
@ -155,6 +155,7 @@ Route::group(['middleware' => 'auth'], function() {
|
||||
Route::get('api/invoices/{client_id?}', array('as'=>'api.invoices', 'uses'=>'InvoiceController@getDatatable'));
|
||||
Route::get('invoices/create/{client_id?}', 'InvoiceController@create');
|
||||
Route::get('recurring_invoices/create/{client_id?}', 'InvoiceController@createRecurring');
|
||||
Route::get('recurring_invoices', 'RecurringInvoiceController@index');
|
||||
Route::get('invoices/{public_id}/clone', 'InvoiceController@cloneInvoice');
|
||||
Route::post('invoices/bulk', 'InvoiceController@bulk');
|
||||
|
||||
|
@ -41,11 +41,13 @@ class AppServiceProvider extends ServiceProvider {
|
||||
<li><a href="'.URL::to($types.'/create').'">'.trans("texts.new_$type").'</a></li>';
|
||||
|
||||
if ($type == ENTITY_INVOICE) {
|
||||
$str .= '<li><a href="'.URL::to('recurring_invoices/create').'">'.trans("texts.new_recurring_invoice").'</a></li>';
|
||||
$str .= '<li class="divider"></li>
|
||||
<li><a href="'.URL::to('recurring_invoices').'">'.trans("texts.recurring_invoices").'</a></li>
|
||||
<li><a href="'.URL::to('recurring_invoices/create').'">'.trans("texts.new_recurring_invoice").'</a></li>';
|
||||
if (Auth::user()->isPro()) {
|
||||
$str .= '<li class="divider"></li>
|
||||
<li><a href="'.URL::to('quotes').'">'.trans("texts.quotes").'</a></li>
|
||||
<li><a href="'.URL::to('quotes/create').'">'.trans("texts.new_quote").'</a></li>';
|
||||
<li><a href="'.URL::to('quotes').'">'.trans("texts.quotes").'</a></li>
|
||||
<li><a href="'.URL::to('quotes/create').'">'.trans("texts.new_quote").'</a></li>';
|
||||
}
|
||||
} else if ($type == ENTITY_CLIENT) {
|
||||
$str .= '<li class="divider"></li>
|
||||
|
@ -26,6 +26,7 @@
|
||||
<input id="tableFilter" type="text" style="width:140px;margin-right:17px;background-color: white !important" class="form-control pull-left" placeholder="{{ trans('texts.filter') }}"/>
|
||||
@if (Auth::user()->isPro() && $entityType == ENTITY_INVOICE)
|
||||
{!! Button::normal(trans('texts.quotes'))->asLinkTo(URL::to('/quotes'))->appendIcon(Icon::create('list')) !!}
|
||||
{!! Button::normal(trans('texts.recurring'))->asLinkTo(URL::to('/recurring_invoices'))->appendIcon(Icon::create('list')) !!}
|
||||
@elseif ($entityType == ENTITY_CLIENT)
|
||||
{!! Button::normal(trans('texts.credits'))->asLinkTo(URL::to('/credits'))->appendIcon(Icon::create('list')) !!}
|
||||
@endif
|
||||
@ -34,14 +35,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
@if (isset($secEntityType))
|
||||
{!! Datatable::table()
|
||||
->addColumn($secColumns)
|
||||
->setUrl(route('api.' . $secEntityType . 's'))
|
||||
->setOptions('sPaginationType', 'bootstrap')
|
||||
->render('datatable') !!}
|
||||
@endif
|
||||
|
||||
{!! Datatable::table()
|
||||
->addColumn($columns)
|
||||
->setUrl(route('api.' . $entityType . 's'))
|
||||
@ -115,9 +108,6 @@
|
||||
}
|
||||
tableFilter = val;
|
||||
oTable0.fnFilter(val);
|
||||
@if (isset($secEntityType))
|
||||
oTable1.fnFilter(val);
|
||||
@endif
|
||||
}
|
||||
|
||||
$('#tableFilter').on('keyup', function(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user