diff --git a/resources/views/list.blade.php b/resources/views/list.blade.php index 15770b165f..1be6041757 100644 --- a/resources/views/list.blade.php +++ b/resources/views/list.blade.php @@ -218,6 +218,12 @@ $('#statusWrapper_{{ $entityType }}').show(); + + @for ($i = 1; $i <= 10; $i++) + Mousetrap.bind('g {{ $i }}', function(e) { + location.href = $('#DataTables_Table_0').find('tr:nth-child({{ $i }})').find('a').attr('href'); + }); + @endfor }); diff --git a/resources/views/partials/keyboard_shortcuts.blade.php b/resources/views/partials/keyboard_shortcuts.blade.php index 6ab675a781..bc8d51a110 100644 --- a/resources/views/partials/keyboard_shortcuts.blade.php +++ b/resources/views/partials/keyboard_shortcuts.blade.php @@ -192,7 +192,16 @@ 'r' => ENTITY_RECURRING_INVOICE, ] as $key => $value) Mousetrap.bind('n {{ $key }}', function(e) { - location.href = "{{ url($value . 's/create') }}"; + var link = "{{ url($value . 's/create') }}"; + @if (in_array($value, [ENTITY_INVOICE, ENTITY_PAYMENT, ENTITY_TASK, ENTITY_VENDOR, ENTITY_RECURRING_INVOICE])) + if (location.pathname.indexOf('/clients/') >= 0) { + var matches = location.pathname.match(/\d+/g); + if (matches.length) { + link += '/' + matches[0]; + } + } + @endif + location.href = link; }); Mousetrap.bind('l {{ $key }}', function(e) { location.href = "{{ url($value . 's') }}";