mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Optimized client view page
This commit is contained in:
parent
44336fd7c4
commit
30631b2bc4
@ -19,6 +19,7 @@ class CreditRepository extends BaseRepository
|
||||
->join('contacts', 'contacts.client_id', '=', 'clients.id')
|
||||
->where('clients.account_id', '=', \Auth::user()->account_id)
|
||||
->where('clients.deleted_at', '=', null)
|
||||
->where('contacts.deleted_at', '=', null)
|
||||
->where('contacts.is_primary', '=', true)
|
||||
->select('credits.public_id', 'clients.name as client_name', 'clients.public_id as client_public_id', 'credits.amount', 'credits.balance', 'credits.credit_date', 'clients.currency_id', 'contacts.first_name', 'contacts.last_name', 'contacts.email', 'credits.private_notes', 'credits.deleted_at', 'credits.is_deleted');
|
||||
|
||||
|
@ -12,7 +12,8 @@ class DatatableService
|
||||
|
||||
if ($actions && $showCheckbox) {
|
||||
$table->addColumn('checkbox', function ($model) {
|
||||
return '<input type="checkbox" name="ids[]" value="' . $model->public_id . '" ' . Utils::getEntityRowClass($model) . '>';
|
||||
return '<input type="checkbox" name="ids[]" value="' . $model->public_id
|
||||
. '" ' . Utils::getEntityRowClass($model) . '>';
|
||||
});
|
||||
}
|
||||
|
||||
@ -81,14 +82,17 @@ class DatatableService
|
||||
}
|
||||
|
||||
if ($entityType != ENTITY_USER || $model->public_id) {
|
||||
$str .= "<li><a href=\"javascript:archiveEntity({$model->public_id})\">" . trans("texts.archive_{$entityType}") . "</a></li>";
|
||||
$str .= "<li><a href=\"javascript:archiveEntity({$model->public_id})\">"
|
||||
. trans("texts.archive_{$entityType}") . "</a></li>";
|
||||
}
|
||||
} else {
|
||||
$str .= "<li><a href=\"javascript:restoreEntity({$model->public_id})\">" . trans("texts.restore_{$entityType}") . "</a></li>";
|
||||
$str .= "<li><a href=\"javascript:restoreEntity({$model->public_id})\">"
|
||||
. trans("texts.restore_{$entityType}") . "</a></li>";
|
||||
}
|
||||
|
||||
if (property_exists($model, 'is_deleted') && !$model->is_deleted) {
|
||||
$str .= "<li><a href=\"javascript:deleteEntity({$model->public_id})\">" . trans("texts.delete_{$entityType}") . "</a></li>";
|
||||
$str .= "<li><a href=\"javascript:deleteEntity({$model->public_id})\">"
|
||||
. trans("texts.delete_{$entityType}") . "</a></li>";
|
||||
}
|
||||
|
||||
return $str.'</ul></div>';
|
||||
|
BIN
public/favicon-v2.png
Normal file
BIN
public/favicon-v2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
@ -186,6 +186,7 @@
|
||||
trans('texts.balance'),
|
||||
trans('texts.adjustment'))
|
||||
->setUrl(url('api/activities/'. $client->public_id))
|
||||
->setCustomValues('entityType', 'activity')
|
||||
->setOptions('sPaginationType', 'bootstrap')
|
||||
->setOptions('bFilter', false)
|
||||
->setOptions('aaSorting', [['0', 'desc']])
|
||||
@ -203,6 +204,7 @@
|
||||
trans('texts.description'),
|
||||
trans('texts.status'))
|
||||
->setUrl(url('api/tasks/'. $client->public_id))
|
||||
->setCustomValues('entityType', 'tasks')
|
||||
->setOptions('sPaginationType', 'bootstrap')
|
||||
->setOptions('bFilter', false)
|
||||
->setOptions('aaSorting', [['0', 'desc']])
|
||||
@ -223,6 +225,7 @@
|
||||
trans('texts.valid_until'),
|
||||
trans('texts.status'))
|
||||
->setUrl(url('api/quotes/'. $client->public_id))
|
||||
->setCustomValues('entityType', 'quotes')
|
||||
->setOptions('sPaginationType', 'bootstrap')
|
||||
->setOptions('bFilter', false)
|
||||
->setOptions('aaSorting', [['0', 'desc']])
|
||||
@ -241,6 +244,7 @@
|
||||
trans('texts.end_date'),
|
||||
trans('texts.invoice_total'))
|
||||
->setUrl(url('api/recurring_invoices/' . $client->public_id))
|
||||
->setCustomValues('entityType', 'recurring_invoices')
|
||||
->setOptions('sPaginationType', 'bootstrap')
|
||||
->setOptions('bFilter', false)
|
||||
->setOptions('aaSorting', [['0', 'asc']])
|
||||
@ -256,6 +260,7 @@
|
||||
trans('texts.due_date'),
|
||||
trans('texts.status'))
|
||||
->setUrl(url('api/invoices/' . $client->public_id))
|
||||
->setCustomValues('entityType', 'invoices')
|
||||
->setOptions('sPaginationType', 'bootstrap')
|
||||
->setOptions('bFilter', false)
|
||||
->setOptions('aaSorting', [['0', 'desc']])
|
||||
@ -272,6 +277,7 @@
|
||||
trans('texts.payment_amount'),
|
||||
trans('texts.payment_date'))
|
||||
->setUrl(url('api/payments/' . $client->public_id))
|
||||
->setCustomValues('entityType', 'payments')
|
||||
->setOptions('sPaginationType', 'bootstrap')
|
||||
->setOptions('bFilter', false)
|
||||
->setOptions('aaSorting', [['0', 'desc']])
|
||||
@ -287,6 +293,7 @@
|
||||
trans('texts.credit_date'),
|
||||
trans('texts.private_notes'))
|
||||
->setUrl(url('api/credits/' . $client->public_id))
|
||||
->setCustomValues('entityType', 'credits')
|
||||
->setOptions('sPaginationType', 'bootstrap')
|
||||
->setOptions('bFilter', false)
|
||||
->setOptions('aaSorting', [['0', 'asc']])
|
||||
@ -297,6 +304,8 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var loadedTabs = {};
|
||||
|
||||
$(function() {
|
||||
$('.normalDropDown:not(.dropdown-toggle)').click(function() {
|
||||
window.location = '{{ URL::to('clients/' . $client->public_id . '/edit') }}';
|
||||
@ -305,13 +314,24 @@
|
||||
window.location = '{{ URL::to('invoices/create/' . $client->public_id ) }}';
|
||||
});
|
||||
|
||||
// load datatable data when tab is shown and remember last tab selected
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||
var target = $(e.target).attr("href") // activated tab
|
||||
target = target.substring(1);
|
||||
localStorage.setItem('client_tab', target);
|
||||
if (!loadedTabs.hasOwnProperty(target)) {
|
||||
loadedTabs[target] = true;
|
||||
window['load_' + target]();
|
||||
if (target == 'invoices') {
|
||||
window['load_recurring_invoices']();
|
||||
}
|
||||
}
|
||||
});
|
||||
var tab = localStorage.getItem('client_tab');
|
||||
var tab = localStorage.getItem('client_tab').replace('#', '');
|
||||
if (tab) {
|
||||
$('.nav-tabs a[href="' + tab + '"]').tab('show');
|
||||
$('.nav-tabs a[href="#' + tab + '"]').tab('show');
|
||||
} else {
|
||||
window['load_activity']();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -32,8 +32,17 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function(){
|
||||
// dynamic table
|
||||
@if (isset($values['entityType']))
|
||||
window.load_{{ $values['entityType'] }} = function load_{{ $values['entityType'] }}() {
|
||||
load_{{ $class }}();
|
||||
}
|
||||
@else
|
||||
jQuery(document).ready(function(){
|
||||
load_{{ $class }}();
|
||||
});
|
||||
@endif
|
||||
|
||||
function load_{{ $class }}() {
|
||||
jQuery('.{{ $class }}').dataTable({
|
||||
"fnRowCallback": function(row, data) {
|
||||
if (data[0].indexOf('ENTITY_DELETED') > 0) {
|
||||
@ -49,7 +58,7 @@
|
||||
// Disable sorting on the first column
|
||||
"aoColumnDefs": [ {
|
||||
'bSortable': false,
|
||||
'aTargets': [ 0, {{ count($columns) - 1 }} ]
|
||||
'aTargets': [ 0, {{ count($columns) - 1 }} ]
|
||||
} ],
|
||||
@endif
|
||||
@foreach ($options as $k => $o)
|
||||
@ -64,5 +73,5 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
@ -354,7 +354,7 @@ function InvoiceModel(data) {
|
||||
|
||||
self.totals.subtotal = ko.computed(function() {
|
||||
var total = self.totals.rawSubtotal();
|
||||
return total > 0 ? formatMoney(total, self.client().currency_id()) : '';
|
||||
return formatMoney(total, self.client().currency_id());
|
||||
});
|
||||
|
||||
self.totals.rawDiscounted = ko.computed(function() {
|
||||
|
@ -6,7 +6,7 @@
|
||||
@else
|
||||
<title>{{ isset($title) ? ($title . ' | Invoice Ninja') : ('Invoice Ninja | ' . trans('texts.app_title')) }}</title>
|
||||
<meta name="description" content="{{ isset($description) ? $description : trans('texts.app_description') }}" />
|
||||
<link href="{{ asset('favicon.png') }}" rel="shortcut icon">
|
||||
<link href="{{ asset('favicon-v2.png') }}" rel="shortcut icon">
|
||||
@endif
|
||||
|
||||
<!-- Source: https://github.com/hillelcoren/invoice-ninja -->
|
||||
|
Loading…
Reference in New Issue
Block a user