Skip to content

Commit

Permalink
Merge pull request #437 from sparc-request/saw-line-item-visit-subjec…
Browse files Browse the repository at this point in the history
…t-count-validation

SAW-Added validations to line item visits subject count
  • Loading branch information
jleonardw9 committed Jun 1, 2016
2 parents d319b97 + 7c05b7b commit 2e702f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@
title: 'Edit subject count',
validate: function(val) {
var n = ~~Number(val);
var max_subject_count = $(this).data('max-subject-count');
if(String(n) != val || n < 0) {
return "quantity must be a nonnegative number";
}
else if(n > max_subject_count) {
return "The N cannot exceed the maximum subject count of the arm (" + max_subject_count + ")";
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
%td.unit_type.text-center= liv.line_item.service.displayed_pricing_map.unit_type
%td.subject_count.text-center
- if tab != 'calendar'
%a.edit-subject-count{ href: '#', data: { type: 'text', pk: liv.line_item.id, name: 'qty', title: 'Edit subject count', value: liv.subject_count, url: "/dashboard/service_calendars.js?service_request_id=#{liv.service_request.id}&line_items_visit=#{liv.id}&tab=#{tab}&portal=#{@portal}" } }
%a.edit-subject-count{ href: '#', data: { type: 'text', pk: liv.line_item.id, name: 'qty', title: 'Edit subject count', value: liv.subject_count, url: "/dashboard/service_calendars.js?service_request_id=#{liv.service_request.id}&line_items_visit=#{liv.id}&tab=#{tab}&portal=#{@portal}", max_subject_count: arm.subject_count } }
- else
%span= liv.subject_count
- if @tab == 'template'
Expand Down

0 comments on commit 2e702f3

Please sign in to comment.