-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakePrescriptionViewController.m
168 lines (107 loc) · 4.45 KB
/
MakePrescriptionViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
//
// MakePrescriptionViewController.m
// ProjectZero
//
// Created by Larkin on 1/3/13.
// Copyright (c) 2013 Larkin. All rights reserved.
//
#import "MakePrescriptionViewController.h"
#import "PrescQRViewController.h"
@interface MakePrescriptionViewController ()
@end
@implementation MakePrescriptionViewController
@synthesize drugName;
@synthesize description;
@synthesize drugNameField;
@synthesize descriptionView;
@synthesize userID;
@synthesize doctorID;
@synthesize addPrescURL;
@synthesize QRImage;
- (void)viewDidLoad
{
//For now
self.doctorID = @"1";
//for now
self.drugNameField.delegate = self;
self.drugNameField.delegate = self;
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSLog(@"QRImage: %@", self.QRImage);
if ([segue.identifier isEqualToString:@"PrescQRSegue"]){
self.drugName = self.drugNameField.text;
self.description = self.descriptionView.text;
NSLog(@"display drug %@",self.drugName);
NSLog(@"Display Desc %@", self.description);
//http://default-environment-ntmkc2r9ez.elasticbeanstalk.com/ProjectZero-server/index.php/QRCodeGen/addPresc/?user_id=1&doctor_id=3&drug=advil¬e=HELLO&refills=5
self.addPrescURL = [[[[[@"http://default-environment-ntmkc2r9ez.elasticbeanstalk.com/ProjectZero-server/index.php/QRCodeGen/addPresc/?user_id=" stringByAppendingString: self.userID] stringByAppendingString:@"&doctor_id="] stringByAppendingString:self.doctorID] stringByAppendingString:@"&drug=" ] stringByAppendingString: self.drugName];
NSLog(@"display addPrescURL: %@", self.addPrescURL);
// NSError* error;
//NSData* data = [NSData dataWithContentsOfURL: [NSURL URLWithString:self.addPrescURL]];
//self.QRImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:self.addPrescURL]]];
PrescQRViewController *destViewController = (PrescQRViewController*)segue.destinationViewController;
//destViewController.QRImage = self.QRImage;
destViewController.drugName = self.drugName;
destViewController.imageURL = self.addPrescURL;
NSLog(@"QRImage: %@", self.QRImage);
}
}
- (IBAction)pressMakePresc:(id)sender;
{
// //For now
// self.doctorID = @"1";
// //for now
//
//
// self.drugNameField.delegate = self;
// self.drugNameField.delegate = self;
//
// self.drugName = self.drugNameField.text;
// self.description = self.descriptionView.text;
//
//
// NSLog(@"display drug %@",self.drugName);
// NSLog(@"Display Desc %@", self.description);
//
//
////http://default-environment-ntmkc2r9ez.elasticbeanstalk.com/ProjectZero-server/index.php/QRCodeGen/addPresc/?user_id=1&doctor_id=3&drug=advil¬e=HELLO&refills=5
//
//
//
// self.addPrescURL = [[[[[@"http://default-environment-ntmkc2r9ez.elasticbeanstalk.com/ProjectZero-server/index.php/QRCodeGen/addPresc/?user_id=" stringByAppendingString: self.userID] stringByAppendingString:@"&doctor_id="] stringByAppendingString:self.doctorID] stringByAppendingString:@"&drug=" ] stringByAppendingString: self.drugName];
//
// NSLog(@"display addPrescURL: %@", self.addPrescURL);
//
// // NSError* error;
// //NSData* data = [NSData dataWithContentsOfURL: [NSURL URLWithString:self.addPrescURL]];
//
//
// self.QRImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:self.addPrescURL]]];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
//Touch outside of box
[self.view endEditing:YES];
[super touchesBegan:touches withEvent:event];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
NSLog(@"textFieldShouldReturn:");
[textField resignFirstResponder];
return YES;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end