Created
October 17, 2016 12:08
-
-
Save grimmwerks/c534a931aa33baa4992ea4807307edb9 to your computer and use it in GitHub Desktop.
promotion reload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
3 => "Rigo 1 strap brace", | |
2 => "Rigo 2 strap brace", | |
1 => "Rigo 3 strap brace" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"role": "doctor", | |
"id": 2, | |
"firstname": "", | |
"lastname": "", | |
"email": "doctor@test.com", | |
"product_styles": [ | |
{ | |
"id": 1, | |
"name": "Rigo", | |
"description": "" | |
}, | |
{ | |
"id": 2, | |
"name": "Boston", | |
"description": "" | |
} | |
], | |
"base_products": [ | |
{ | |
"id": 4, | |
"name": "Boston calibration", | |
"description": "", | |
"style_id": 2, | |
"sensor_locations": { | |
"middle": 2, | |
"lower": 3 | |
}, | |
"product_feedbacks": {} | |
}, | |
{ | |
"id": 3, | |
"name": "Rigo 1 strap brace", | |
"description": "", | |
"style_id": 1, | |
"sensor_locations": { | |
"middle": 2 | |
}, | |
"product_feedbacks": { | |
"light": 1, | |
"vibration": 2 | |
} | |
}, | |
{ | |
"id": 2, | |
"name": "Rigo 2 strap brace", | |
"description": "", | |
"style_id": 1, | |
"sensor_locations": { | |
"upper": 1, | |
"lower": 3 | |
}, | |
"product_feedbacks": { | |
"light": 1, | |
"vibration": 2 | |
} | |
}, | |
{ | |
"id": 1, | |
"name": "Rigo 3 strap brace", | |
"description": "", | |
"style_id": 1, | |
"sensor_locations": { | |
"upper": 1, | |
"middle": 2, | |
"lower": 3 | |
}, | |
"product_feedbacks": { | |
"light": 1, | |
"vibration": 2 | |
} | |
} | |
], | |
"patients": [ | |
{ | |
"role": "patient", | |
"id": 23, | |
"firstname": "", | |
"lastname": "", | |
"email": "10@test.com", | |
"birthday": null, | |
"username": "10", | |
"treatment_start": "2016-02-16T11:31:00.000-05:00", | |
"products": [ | |
{ | |
"id": 25, | |
"base_product_id": 2, | |
"active": true, | |
"passkey": null, | |
"feedback_states": [ | |
{ | |
"name": "light", | |
"value": 1, | |
"active": true | |
}, | |
{ | |
"name": "vibration", | |
"value": 2, | |
"active": true | |
} | |
], | |
"active_feedback": { | |
"light": 1, | |
"vibration": 2 | |
}, | |
"treatment": { | |
"id": 24, | |
"product_id": 25, | |
"start": "2016-02-16T11:31:00.000-05:00", | |
"end": null, | |
"summary": "", | |
"prescriptions": [] | |
}, | |
"sensors": [ | |
{ | |
"id": 62, | |
"serial": "", | |
"active": true, | |
"location": 1, | |
"location_string": "upper" | |
}, | |
{ | |
"id": 63, | |
"serial": "", | |
"active": true, | |
"location": 3, | |
"location_string": "lower" | |
} | |
] | |
} | |
], | |
"parents": [] | |
}, | |
{ | |
"role": "patient", | |
"id": 8, | |
"firstname": "", | |
"lastname": "", | |
"email": "5@test.com", | |
"birthday": null, | |
"username": "5", | |
"treatment_start": "2015-08-13T14:40:43.575-04:00", | |
"products": [ | |
{ | |
"id": 12, | |
"base_product_id": 2, | |
"active": true, | |
"passkey": "654321", | |
"feedback_states": [ | |
{ | |
"name": "light", | |
"value": 1, | |
"active": false | |
}, | |
{ | |
"name": "vibration", | |
"value": 2, | |
"active": false | |
} | |
], | |
"active_feedback": {}, | |
"treatment": { | |
"id": 11, | |
"product_id": 12, | |
"start": "2015-08-13T14:40:43.575-04:00", | |
"end": null, | |
"summary": null, | |
"prescriptions": [ | |
{ | |
"id": 11, | |
"hours": 14, | |
"summary": "2015-09-15 17:57:59 +0000 - Changing hours to: 14", | |
"prescription_date": "2015-09-15T13:57:59.742-04:00", | |
"prescribed_tensions": [ | |
{ | |
"id": 20, | |
"force": 25, | |
"position": 50, | |
"location": 3, | |
"location_string": "lower" | |
}, | |
{ | |
"id": 21, | |
"force": 25, | |
"position": 50, | |
"location": 1, | |
"location_string": "upper" | |
} | |
] | |
}, | |
{ | |
"id": 10, | |
"hours": 16, | |
"summary": null, | |
"prescription_date": "2015-08-13T14:40:43.658-04:00", | |
"prescribed_tensions": [ | |
{ | |
"id": 18, | |
"force": 25, | |
"position": 50, | |
"location": 3, | |
"location_string": "lower" | |
}, | |
{ | |
"id": 19, | |
"force": 25, | |
"position": 50, | |
"location": 1, | |
"location_string": "upper" | |
} | |
] | |
} | |
] | |
}, | |
"sensors": [ | |
{ | |
"id": 35, | |
"serial": "D36330135F1A3C36", | |
"active": true, | |
"location": 3, | |
"location_string": "lower" | |
}, | |
{ | |
"id": 34, | |
"serial": "D36330135F2A3823", | |
"active": true, | |
"location": 1, | |
"location_string": "upper" | |
} | |
] | |
} | |
], | |
"parents": [] | |
}, | |
{ | |
"role": "patient", | |
"id": 25, | |
"firstname": "", | |
"lastname": "", | |
"email": "30@test.com", | |
"birthday": null, | |
"username": "30", | |
"treatment_start": "2016-04-28T13:15:00.000-04:00", | |
"products": [ | |
{ | |
"id": 30, | |
"base_product_id": 3, | |
"active": true, | |
"passkey": null, | |
"feedback_states": [ | |
{ | |
"name": "light", | |
"value": 1, | |
"active": true | |
}, | |
{ | |
"name": "vibration", | |
"value": 2, | |
"active": true | |
} | |
], | |
"active_feedback": { | |
"light": 1, | |
"vibration": 2 | |
}, | |
"treatment": { | |
"id": 26, | |
"product_id": 30, | |
"start": "2016-04-28T13:15:00.000-04:00", | |
"end": null, | |
"summary": "", | |
"prescriptions": [ | |
{ | |
"id": 24, | |
"hours": 14, | |
"summary": "", | |
"prescription_date": "2016-04-29T13:16:00.000-04:00", | |
"prescribed_tensions": [ | |
{ | |
"id": 44, | |
"force": 25, | |
"position": 40, | |
"location": 1, | |
"location_string": "upper" | |
} | |
] | |
} | |
] | |
}, | |
"sensors": [ | |
{ | |
"id": 65, | |
"serial": "30_01", | |
"active": true, | |
"location": 1, | |
"location_string": "upper" | |
} | |
] | |
} | |
], | |
"parents": [] | |
}, | |
{ | |
"role": "patient", | |
"id": 29, | |
"firstname": "Adam", | |
"lastname": "Adam", | |
"email": "adam@test.com", | |
"birthday": null, | |
"username": "Adam", | |
"treatment_start": "", | |
"products": [], | |
"parents": [] | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OrthoCreateBraceScreen < PM::XLFormScreen | |
# < PM::TableScreen | |
title "New Brace" | |
stylesheet OrthoCreateBraceScreenStylesheet | |
attr_accessor :doctor, :patient, :data | |
form_options required: :asterisks, | |
# on_save: :'save_form:', | |
# on_cancel: :cancel_form, | |
auto_focus: true | |
def on_init | |
# find(UITableView).get.tableHeaderView = create!(OrthoScreenTitle, :screen_header) | |
screen.navigationController.navigationBar.barTintColor=UIColor.greenColor | |
@data = {:base => [], :locations => []} | |
end | |
def on_appear | |
# update_form_data | |
# IF I HAVE UPDATE FORM DATA | |
# THEN THE FIRST CELL SELECTION GETS RESET | |
end | |
# Hash[ | |
# doctor['base_products'].map do |bp| | |
# if !values[:style].nil? | |
# if bp['style_id'] == values[:style] | |
# [bp['id'], bp['name']] | |
# end | |
# end | |
# end | |
# ] | |
def base_product_options(val) | |
ret = Hash[doctor['base_products'].map do |bp| | |
if bp['style_id'] == val | |
[bp['id'], bp['name']] | |
end | |
end] | |
mp ret | |
@data[:base] = ret | |
end | |
def form_data | |
[ | |
{ | |
cells: | |
[ | |
{ | |
name: :style, | |
title: 'Brace Style', | |
type: :selector_alert_view, | |
options: Hash[doctor['product_styles'].map do |ps| | |
[ps['id'], ps['name']] | |
end], | |
on_change: lambda do |old_value, new_value| | |
base_product_options(new_value) | |
end | |
}, | |
{ | |
name: :base, | |
title: "Straps", | |
type: :selector_alert_view, | |
hidden: { | |
name: :style, | |
is: :equal, | |
value: nil | |
}, | |
options: @data[:base] | |
} | |
# { | |
# name: :locations, | |
# title: "Locations", | |
# type: :selector_popover, | |
# hidden: { | |
# name: :base, | |
# is: :equal, | |
# value: nil | |
# } | |
# } | |
] | |
} | |
] | |
end | |
def save_form(values) | |
mp on_save: values | |
end | |
def cancel_form | |
mp 'cancel_form has been called' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment