Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jjh session #799

Merged
merged 13 commits into from
Dec 9, 2016
8 changes: 7 additions & 1 deletion app/assets/javascripts/associated_users.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,25 @@
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
$(document).ready ->
getSRId = () ->
$('input[name="service_request_id"]').val()

$(document).on 'click', '#new-associated-user-button', ->
$.ajax
type: 'get'
url: '/associated_users/new.js'
data:
protocol_id: $(this).data('protocol-id')
service_request_id: getSRId()
return false

$(document).on 'click', '.edit-associated-user-button', (event) ->
project_role_id = $(this).data('project-role-id')
$.ajax
type: 'get'
url: "/associated_users/#{project_role_id}/edit.js"
data:
service_request_id: getSRId()
success: ->
if $('#project_role_role').val() == 'other'
$('.role_dependent.other').show()
Expand All @@ -57,5 +63,5 @@ $(document).ready ->
if confirm(confirm_message)
$.ajax
type: 'delete'
url: "/associated_users/#{project_role_id}"
url: "/associated_users/#{project_role_id}?service_request_id=#{getSRId()}"
return false
13 changes: 10 additions & 3 deletions app/assets/javascripts/catalog.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
#= require cart

$(document).ready ->
getSRId = () ->
$('input[name="service_request_id"]').val()

### ACCORDION LOGIC ###
$(document).on 'click', '.institution-header, .provider-header, .program-link:not(.locked-program)', ->
if $(this).hasClass('institution-header')
Expand All @@ -34,7 +37,9 @@ $(document).ready ->
$('.program-link').removeClass('clicked')
$(this).addClass('clicked')
id = $(this).data('id')
data = process_ssr_found : $(this).data('process-ssr-found')
data =
process_ssr_found: $(this).data('process-ssr-found')
service_request_id: getSRId()
$.ajax
type: 'POST'
data: data
Expand Down Expand Up @@ -64,7 +69,7 @@ $(document).ready ->
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote:
url: '/search/services?term=%QUERY',
url: "/search/services?term=%QUERY&service_request_id=#{getSRId()}",
wildcard: '%QUERY'
)
services_bloodhound.initialize() # Initialize the Bloodhound suggestion engine
Expand Down Expand Up @@ -95,13 +100,15 @@ $(document).ready ->
$.ajax
type: 'POST'
url: "/service_requests/#{srid}/add_service/#{id}"
data:
service_request_id: getSRId()
)

### CONTINUE BUTTON ###
$(document).on 'click', '.submit-request-button', ->
signed_in = parseInt($('#signed_in').val())
if signed_in == 0
window.location.replace('/identities/sign_in')
window.location.href = $('#login-link').attr('href')
return false
else if $('#line_item_count').val() <= 0
$('#modal_place').html($('#submit-error-modal').html())
Expand Down
11 changes: 9 additions & 2 deletions app/assets/javascripts/dashboard/documents.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

$ ->
getSRId = ->
$("input[name='service_request_id']").val()

# DOCUMENTS LISTENERS BEGIN

$(document).on 'click', '#document-new', ->
if $(this).data('permission')
data = 'protocol_id': $(this).data('protocol-id')
data =
protocol_id: $(this).data('protocol-id')
service_request_id: getSRId()

$.ajax
type: 'GET'
url: '/dashboard/documents/new'
Expand All @@ -37,6 +42,8 @@ $ ->
$.ajax
type: 'GET'
url: "/dashboard/documents/#{document_id}/edit"
data:
service_request_id: getSRId()

$(document).on 'click', '.document-delete', ->
if $(this).data('permission')
Expand All @@ -45,7 +52,7 @@ $ ->
if confirm "Are you sure you want to delete the selected Document from this Protocol?"
$.ajax
type: 'DELETE'
url: "/dashboard/documents/#{document_id}"
url: "/dashboard/documents/#{document_id}?service_request_id=#{getSRId()}"

$(document).on 'change', '#document_doc_type', ->
if $(this).val() == 'other'
Expand Down
5 changes: 5 additions & 0 deletions app/assets/javascripts/dashboard/protocols.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
$(document).ready ->
Sparc.protocol =
ready: ->
getSRId = () ->
$('input[name="service_request_id"]').val()

$('.service-requests-table').on 'all.bs.table', ->
$(this).find('.selectpicker').selectpicker() #Find descendant selectpickers

Expand Down Expand Up @@ -116,6 +119,8 @@ $(document).ready ->
$.ajax
method: 'get'
url: "/dashboard/protocols/#{protocol_id}/view_details"
data:
service_request_id: $("input[name='service_request_id']").val()

$(document).on 'click', '.edit-protocol-information-button', ->
if $(this).data('permission')
Expand Down
12 changes: 10 additions & 2 deletions app/assets/javascripts/document_management.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@
#= require cart

$(document).ready ->
getSRId = ->
$("input[name='service_request_id']").val()

$(document).on 'click', '#document-new', ->
data = 'protocol_id': $(this).data('protocol-id')
data =
protocol_id: $(this).data('protocol-id')
service_request_id: getSRId()
$.ajax
type: 'GET'
url: '/documents/new'
Expand All @@ -36,14 +41,16 @@ $(document).ready ->
$.ajax
type: 'GET'
url: "/documents/#{document_id}/edit"
data:
service_request_id: getSRId()

$(document).on 'click', '.document-delete', ->
row_index = $(this).parents('tr').data('index')
document_id = $(this).parents('table#documents-table').bootstrapTable('getData')[row_index].id
if confirm I18n['documents']['delete_confirm']
$.ajax
type: 'DELETE'
url: "/documents/#{document_id}"
url: "/documents/#{document_id}?service_request_id=#{getSRId()}"

$(document).on 'change', '#document_doc_type', ->
if $(this).val() == 'other'
Expand All @@ -62,4 +69,5 @@ $(document).ready ->
notable_type: notable_type
notable_id: notable_id
in_dashboard: false
service_request_id: getSRId()
return false
2 changes: 2 additions & 0 deletions app/assets/javascripts/protocol.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ $(document).ready ->
$.ajax
type: 'get'
url: "/protocols/#{protocol_id}/view_details"
data:
service_request_id: $("input[name='service_request_id']").val()
return false
95 changes: 71 additions & 24 deletions app/assets/javascripts/service_calendar.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
#= require navigation

$(document).ready ->
getSRId = ->
$("input[name='service_request_id']").val()

getSSRId = ->
$("input[name='sub_service_request_id']").val()

$(document).on 'click', '.page-change-arrow', ->
unless $(this).attr('disabled')
$.ajax
Expand Down Expand Up @@ -53,7 +59,9 @@ $(document).ready ->
$.ajax
type: 'GET'
url: '/service_calendars/show_move_visits'
data: arm_id: arm_id
data:
arm_id: arm_id
service_request_id: getSRId()
return false

$(document).on 'change', '.visit-quantity', ->
Expand All @@ -67,6 +75,8 @@ $(document).ready ->
visit_id: $(this).data('visit-id')
portal: $(this).data('portal')
sub_service_request_id: $(this).data('ssrid')
service_request_id: getSRId()
sub_service_request_id: getSSRId()
url: $(this).attr('update')

(exports ? this).changing_tabs_calculating_rates = ->
Expand Down Expand Up @@ -100,14 +110,18 @@ calculate_max_rates = (arm_id) ->
$(".arm-calendar-container-#{arm_id}:visible #{column}.max-indirect-per-patient").html(indirect_total_display)
$(".arm-calendar-container-#{arm_id}:visible #{column}.max-total-per-patient").html(max_total_display)

getSRId = ->
$("input[name='service_request_id']").val()

(exports ? this).setup_xeditable_fields = () ->
reload_calendar = (arm_id) ->
# E.g. "billing-strategy-tab" -> "billing_strategy"
tab = $('li.custom-tab.active a').last().attr('id')
tab = tab.substring(0, tab.indexOf("tab") - 1).replace("-", "_");
tab = tab.substring(0, tab.indexOf("tab") - 1).replace("-", "_")
data = $('#service-calendars').data()
data.tab = tab
data.arm_id = arm_id
data.service_request_id = getSRId()
# Reload calendar
$.get '/service_calendars/table.js', data

Expand All @@ -125,65 +139,98 @@ calculate_max_rates = (arm_id) ->

$('.window-before').editable
params: (params) ->
data = 'visit_group': { 'window_before': params.value }
return data
{
visit_group:
window_before: params.value
service_request_id: getSRId()
}

$('.day').editable
params: (params) ->
data = 'visit_group': { 'day': params.value }
return data
{
visit_group:
day: params.value
service_request_id: getSRId()
}
emptytext: '(?)'

$('.window-after').editable
params: (params) ->
data = 'visit_group': { 'window_after': params.value }
return data
{
visit_group:
window_after: params.value
service_request_id: getSRId()
}

$('.visit-group-name').editable
params: (params) ->
data = 'visit_group': { 'name': params.value }
return data
{
visit_group:
name: params.value
service_request_id: getSRId()
}
emptytext: '(?)'

$('.edit-your-cost').editable
display: (value) ->
# display field as currency, edit as quantity
$(this).text("$" + parseFloat(value).toFixed(2))
params: (params) ->
data = 'line_item': { 'displayed_cost': params.value }
return data
{
line_item:
displayed_cost: params.value
service_request_id: getSRId()
}
success: ->

$('.edit-subject-count').editable
params: (params) ->
data = 'line_items_visit': { 'subject_count': params.value }
return data
{
line_items_visit:
subject_count: params.value
service_request_id: getSRId()
}
success: () ->
reload_calendar($(this).data('armId'))

$('.edit-research-billing-qty').editable
params: (params) ->
data = 'visit': { 'research_billing_qty': params.value }
return data
{
visit:
research_billing_qty: params.value
service_request_id: getSRId()
}
success: () ->
reload_calendar($(this).data('armId'))

$('.edit-insurance-billing-qty').editable
params: (params) ->
data = 'visit': { 'insurance_billing_qty': params.value }
return data
{
visit:
insurance_billing_qty: params.value
service_request_id: getSRId()
}

$('.edit-effort-billing-qty').editable
params: (params) ->
data = 'visit': { 'effort_billing_qty': params.value }
return data
{
visit:
effort_billing_qty: params.value
service_request_id: getSRId()
}

$('.edit-qty').editable
params: (params) ->
data = 'line_item': { 'quantity': params.value }
return data
{
line_item:
quantity: params.value
service_request_id: getSRId()
}

$('.edit-units-per-qty').editable
params: (params) ->
data = 'line_item': { 'units_per_quantity': params.value }
return data
{
line_item:
units_per_quantity: params.value
service_request_id: getSRId()
}
8 changes: 7 additions & 1 deletion app/assets/javascripts/service_details.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,25 @@
#= require cart

$(document).ready ->
getSRId = ->
$("input[name='service_request_id']").val()

$(document).on 'click', '#new-arm-button', ->
$.ajax
type: 'get'
url: '/arms/new'
data:
protocol_id: $(this).data('protocol-id')
service_request_id: getSRId()
return false

$(document).on 'click', '.edit-arm-button', ->
arm_id = $(this).data('arm-id')
$.ajax
type: 'get'
url: "/arms/#{arm_id}/edit"
data:
service_request_id: getSRId()

$(document).on 'click', '#edit-arm-form-button', ->
$(this).attr('disabled','disabled')
Expand All @@ -45,7 +51,7 @@ $(document).ready ->
arm_id = $(this).data('arm-id')
$.ajax
type: 'delete'
url: "/arms/#{arm_id}"
url: "/arms/#{arm_id}?service_request_id=#{getSRId()}"

$('#arms-table').on 'all.bs.table', ->
$('.screening-info').tooltip()
Expand Down