mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Working on datatables on vendor page
This commit is contained in:
parent
a518e9fba4
commit
12fd825de5
@ -33,12 +33,12 @@ class BaseController extends Controller
|
||||
$referer = Request::server('HTTP_REFERER');
|
||||
$entityTypes = Utils::pluralizeEntityType($entityType);
|
||||
|
||||
if (strpos($referer, '/clients/')) {
|
||||
// when restoring redirect to entity
|
||||
return redirect($referer);
|
||||
} elseif ($action == 'restore' && count($ids) == 1) {
|
||||
if ($action == 'restore' && count($ids) == 1) {
|
||||
return redirect("{$entityTypes}/" . $ids[0]);
|
||||
// when viewing from a datatable list
|
||||
} elseif (strpos($referer, '/clients/')) {
|
||||
return redirect($referer);
|
||||
} elseif ($isDatatable || ($action == 'archive' || $action == 'delete')) {
|
||||
return redirect("{$entityTypes}");
|
||||
// when viewing individual entity
|
||||
|
@ -206,7 +206,7 @@ Route::group(['middleware' => 'auth:user'], function() {
|
||||
Route::resource('expenses', 'ExpenseController');
|
||||
Route::get('expenses/create/{vendor_id?}/{client_id?}', 'ExpenseController@create');
|
||||
Route::get('api/expenses', 'ExpenseController@getDatatable');
|
||||
Route::get('api/vendor_expenses/{id}', 'ExpenseController@getDatatableVendor');
|
||||
Route::get('api/expenses/{id}', 'ExpenseController@getDatatableVendor');
|
||||
Route::post('expenses/bulk', 'ExpenseController@bulk');
|
||||
Route::get('expense_categories', 'ExpenseCategoryController@index');
|
||||
Route::get('api/expense_categories', 'ExpenseCategoryController@getDatatable');
|
||||
|
@ -82,7 +82,7 @@ class ExpenseService extends BaseService
|
||||
*/
|
||||
public function getDatatableVendor($vendorPublicId)
|
||||
{
|
||||
$datatable = new ExpenseDatatable(false, true);
|
||||
$datatable = new ExpenseDatatable(true, true);
|
||||
|
||||
$query = $this->expenseRepo->findVendor($vendorPublicId);
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
@if (isset($values['entityType']))
|
||||
if (window.onDatatableReady_{{ $values['entityType'] }}) {
|
||||
window.onDatatableReady_{{ $values['entityType'] }}();
|
||||
} else {
|
||||
} else if (window.onDatatableReady) {
|
||||
window.onDatatableReady();
|
||||
}
|
||||
@else
|
||||
|
@ -58,7 +58,7 @@
|
||||
{!! Button::normal(trans('texts.categories'))->asLinkTo(URL::to('/expense_categories'))->appendIcon(Icon::create('list')) !!}
|
||||
@endif
|
||||
|
||||
@if (Auth::user()->can('create', $entityType))
|
||||
@if (empty($vendorId) && Auth::user()->can('create', $entityType))
|
||||
{!! Button::primary(trans("texts.new_{$entityType}"))->asLinkTo(url(Utils::pluralizeEntityType($entityType) . '/create'))->appendIcon(Icon::create('plus-sign')) !!}
|
||||
@endif
|
||||
@endif
|
||||
@ -68,7 +68,7 @@
|
||||
|
||||
{!! Datatable::table()
|
||||
->addColumn(Utils::trans($datatable->columnFields()))
|
||||
->setUrl(url('api/' . Utils::pluralizeEntityType($entityType) . '/' . (isset($clientId) ? $clientId : '')))
|
||||
->setUrl(url('api/' . Utils::pluralizeEntityType($entityType) . '/' . (isset($clientId) ? $clientId : (isset($vendorId) ? $vendorId : ''))))
|
||||
->setCustomValues('rightAlign', isset($rightAlign) ? $rightAlign : [])
|
||||
->setCustomValues('entityType', Utils::pluralizeEntityType($entityType))
|
||||
->setCustomValues('clientId', isset($clientId) && $clientId)
|
||||
|
24
resources/views/vendors/show.blade.php
vendored
24
resources/views/vendors/show.blade.php
vendored
@ -3,6 +3,9 @@
|
||||
@section('head')
|
||||
@parent
|
||||
|
||||
<script src="{{ asset('js/select2.min.js') }}" type="text/javascript"></script>
|
||||
<link href="{{ asset('css/select2.css') }}" rel="stylesheet" type="text/css"/>
|
||||
|
||||
@if ($vendor->hasAddress())
|
||||
<style>
|
||||
#map {
|
||||
@ -167,22 +170,15 @@
|
||||
|
||||
<ul class="nav nav-tabs nav-justified">
|
||||
{!! Form::tab_link('#expenses', trans('texts.expenses')) !!}
|
||||
</ul>
|
||||
</ul><br/>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane" id="expenses">
|
||||
{!! Datatable::table()
|
||||
->addColumn(
|
||||
trans('texts.expense_date'),
|
||||
trans('texts.amount'),
|
||||
trans('texts.public_notes'))
|
||||
->setUrl(url('api/vendor_expense/' . $vendor->public_id))
|
||||
->setCustomValues('entityType', 'expenses')
|
||||
->setOptions('sPaginationType', 'bootstrap')
|
||||
->setOptions('bFilter', false)
|
||||
->setOptions('aaSorting', [['0', 'asc']])
|
||||
->render('datatable')
|
||||
!!}
|
||||
@include('list', [
|
||||
'entityType' => ENTITY_EXPENSE,
|
||||
'datatable' => new \App\Ninja\Datatables\ExpenseDatatable(true, true),
|
||||
'vendorId' => $vendor->public_id,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -199,7 +195,7 @@
|
||||
});
|
||||
|
||||
$('.nav-tabs a[href="#expenses"]').tab('show');
|
||||
load_expenses();
|
||||
//load_expenses();
|
||||
});
|
||||
|
||||
function onArchiveClick() {
|
||||
|
Loading…
Reference in New Issue
Block a user