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

Click on table rows to mark checkbox

This commit is contained in:
David Bomba 2019-08-28 15:19:36 +10:00
parent 1c31f6de0f
commit 17b2bc4e69
2 changed files with 24 additions and 10 deletions

View File

@ -60,8 +60,6 @@ class Number
*/
public static function formatMoney($value, $currency, $country, $settings)
{
Log::error('code = '.$settings->show_currency_code);
Log::error('symbol = '.$settings->show_currency_symbol);
$thousand = $currency->thousand_separator;
$decimal = $currency->decimal_separator;

View File

@ -114,7 +114,7 @@ $(function() {
},
columns: [
{data: 'checkbox', name: 'checkbox', title: '<input type="checkbox" class="select_all">', searchable: false, orderable: false},
{data: 'checkbox', name: 'checkbox', title: '<input type="checkbox" class="select_all" >', searchable: false, orderable: false},
{data: 'invoice_number', name: 'invoice_number', title: '{{ctrans('texts.invoice_number')}}', visible: true},
{data: 'invoice_date', name: 'invoice_date', title: '{{ctrans('texts.invoice_date')}}', visible: true},
{data: 'amount', name: 'amount', title: '{{ctrans('texts.total')}}', visible: true},
@ -136,14 +136,19 @@ $(document).ready(function() {
toggleButtonGroup();
$("#datatable").on('change', 'input[type=checkbox]', function() {
selected = [];
$.each($("input[name='hashed_ids[]']:checked"), function(){
selected.push($(this).val());
});
$('#datatable').on('click', '.odd, .even' ,function(e) {
if($(e.target).is(':checkbox')) return; //ignore when click on the checkbox
toggleButtonGroup();
var $cb= $(this).find('input[type="checkbox"]');
$cb.prop('checked', !$cb.is(':checked'));
buildCheckboxArray();
});
$("#datatable").on('change', 'input[type=checkbox]', function() {
buildCheckboxArray();
});
$('#table_filter').on('keyup', function(){
@ -179,6 +184,17 @@ $(document).ready(function() {
});
function buildCheckboxArray()
{
selected = [];
$.each($("input[name='hashed_ids[]']:checked"), function(){
selected.push($(this).val());
});
toggleButtonGroup();
}
function toggleButtonGroup()
{
if(selected.length == 0)