Fix function calculate payments and add directive ngPaginate