1 2var taxes = { 3 data: [], 4 total: 0, 5 filter: { 6 search: "", 7 size: 25, 8 page: 1, 9 sort: "state", 10 sortType: "asc" 11 }, 12 get: function() { 13 service.call("taxes", taxes.filter, taxes.returned); 14 }, 15 returned: function(e) { 16 if (e.error) growler.error(e.error); 17 else { 18 taxes.data = e.data; 19 taxes.total = e.total; 20 context.set("taxes", taxes.data); 21 } 22 }, 23 getState: function(state, zip) { 24 service.call("taxByState", { state: state, zip: zip }, taxes.stateReturned); 25 }, 26 stateReturned: function(e) { 27 context.set("purchaseTax", e.taxes); 28 }, 29 save: function(state, postalCode, percentage, category, type, cost, id) { 30 var params = taxes.filter; 31 params.id = id; 32 params.state = state; 33 params.percentage = percentage; 34 params.category = category; 35 params.type = type; 36 params.postalCode = postalCode; 37 params.cost = cost; 38 service.call("tax", params, taxes.returned); 39 }, 40 delete: function(ids) { 41 var params = taxes.filter; 42 params.ids = ids; 43 service.call("tax", params, taxes.returned, "DELET
43E"); 44 }, 45 details: function(id) { 46 for (var i=0; i<taxes.data.length; i++) { 47 if (id==taxes.data[i].taxId) return taxes.data[i]; 48 } 49 return null; 50 }, 51 next: function() { 52 if (!isLast()) taxes.filter.page++; 53 else taxes.filter.page = 1; 54 taxes.get(); 55 }, 56 prev: function() { 57 if (taxes.filter.page>1) taxes.filter.page--; 58 else taxes.filter.page = Math.ceil(taxes.total/taxes.filter.size); 59 taxes.get(); 60 }, 61 isLast: function() { 62 return (taxes.total<=(taxes.filter.page*taxes.filter.size)); 63 }, 64 isFirst: function() { 65 return taxes.filter.page==1; 66 }, 67 pageTotal: function() { 68 return Math.ceil(taxes.total/taxes.filter.size); 69 }, 70 goto: function(page) { 71 if (page<=category.pageTotal()&&page>=1) { 72 taxes.filter.page = page; 73 taxes.get(); 74 } 75 } 76}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.