Fixed initial tax rate settings pagination

Pagination need to be set up to 1, since is first page.
This fix a bug where is impossible to insert rates when don't have any rate saved before.

cc @mikejolley
This commit is contained in:
Claudio Sanches 2015-10-27 19:33:12 -02:00
parent 0dbbcd0a16
commit ad5264d40b
3 changed files with 22 additions and 20 deletions

View File

@ -84,7 +84,9 @@
per_page: data.limit,
page: data.page,
initialize: function() {
this.qty_pages = Math.ceil( _.toArray( this.model.get( 'rates' ) ).length / this.per_page );
var qty_pages = Math.ceil( _.toArray( this.model.get( 'rates' ) ).length / this.per_page );
this.qty_pages = 0 === qty_pages ? 1 : qty_pages;
this.page = this.sanitizePage( data.page );
this.listenTo( this.model, 'change:rates', this.setUnloadConfirmation );
@ -107,7 +109,7 @@
var rates = this.model.getFilteredRates(),
qty_rates = _.size( rates ),
qty_pages = Math.ceil( qty_rates / this.per_page ),
first_index = this.per_page * ( this.page - 1),
first_index = 0 === qty_rates ? 0 : this.per_page * ( this.page - 1 ),
last_index = this.per_page * this.page,
paged_rates = _.toArray( rates ).slice( first_index, last_index ),
view = this;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long