Sha256: 2745de6dbf758c2bc475a9e4f3bb99944aa19bf2c02245f1d0ed3b5b95405b8f

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

$(document).ready ->

  return unless $("button#schedule_appointment")

  user = {
    first_name: 'dude'
    last_name: 'dudely',
    email_address: 'dude@dude.com',
    phone_number: '4155551212',
    date_of_birth: '11/12/1990'
  }

  ##########  handling schedule appointment click ############
  $("button#schedule_appointment").click (e)->
    e.preventDefault()
    # use the date selected from the list
    appointment_date_time = $('form#appointment_data_search input:radio[name=appointment_time]:checked').val()
    date = Date.parseExact(appointment_date_time.replace('|',' '), 'M/d/yyyy hh:mm tt')
    time = date.toString('yyyy-M-d hh:mm tt')
    lab_code = $('#lab_list_container input:radio:checked').val()
    params = { lab_code: lab_code, time: time, user: user }
    console.log params
#    $.get("/medivo/labs/make_appointment", params, (data)->
#      console.log data
      # add cancel button to the dom
    $("button#schedule_appointment").insertAfter("<button id='cancel_appointment' data-confirmation='#{lab_code}'>Cancel Appointment</button>")
#    )

  ########### cancel appointment #################
  $('button#cancel_appointment').live('click', (e)->
    e.preventDefault()
    button = $(this)
    confirmation = button.data('confirmation')
    first_name = button.data('first_name')
    last_name = button.data('last_name')
    params = { first_name: first_name, last_name: last_name, confirmation: confirmation }
    console.log params
#    $.get("/medivo/labs/cancel_appointment", params, -> button.remove() )
  )

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
medivo-0.2.24 spec/dummy/app/assets/javascripts/appointment_handlers.js.coffee