1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Customise column width for datatable

This commit is contained in:
David Bomba 2019-10-08 14:04:35 +10:00
parent 75b089fa19
commit fb513ebe69
2 changed files with 15 additions and 2 deletions

View File

@ -50,7 +50,7 @@ class InvoiceController extends Controller
if (request()->ajax()) {
return DataTables::of($invoices)->addColumn('action', function ($invoice) {
return '<a href="/client/invoices/'. $invoice->hashed_id .'" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i>'.ctrans('texts.view').'</a>';
return $this->buildClientButtons($invoice);
})
->addColumn('checkbox', function ($invoice){
return '<input type="checkbox" name="hashed_ids[]" value="'. $invoice->hashed_id .'"/>';
@ -77,6 +77,19 @@ class InvoiceController extends Controller
}
private function buildClientButtons($invoice)
{
$buttons = '<div>';
if($invoice->isPayable()){
$buttons .= '<a href="/client/invoices/'. $invoice->hashed_id .'" class="btn btn-sm btn-info"><i class="glyphicon glyphicon-edit"></i>'.ctrans('texts.pay_now').'</a>';
}
$buttons .= '<a href="/client/invoices/'. $invoice->hashed_id .'" class="btn btn-sm btn-primary"><i class="glyphicon glyphicon-edit"></i>'.ctrans('texts.view').'</a>';
$buttons .="</div>";
return $buttons;
}
/**
* Display the specified resource.
*

View File

@ -121,7 +121,7 @@ $(function() {
{data: 'balance', name: 'balance', title: '{{ctrans('texts.balance')}}', visible: true},
{data: 'due_date', name: 'due_date', title: '{{ctrans('texts.due_date')}}', visible: true},
{data: 'status_id', name: 'status_id', title: '{{ctrans('texts.status')}}', visible: true},
{data: 'action', name: 'action', title: '', searchable: false, orderable: false},
{data: 'action', name: 'action', title: '', searchable: false, orderable: false, width: '10%'},
]
});
});