Permalink
Browse files

final

  • Loading branch information...
1 parent c0d8d0e commit a0b3f1b704b4a667f1835de8909ab1deef65764e @jovhenni19 committed Jan 9, 2014
Showing with 1,060 additions and 438 deletions.
  1. +2 −2 AgentBridge.xcodeproj/project.pbxproj
  2. BIN ...xcodeproj/project.xcworkspace/xcuserdata/host24_iosdev.xcuserdatad/UserInterfaceState.xcuserstate
  3. +1 −1 AgentBridge/ABridge_ActivityAgentPOPsViewController.m
  4. +1 −1 AgentBridge/ABridge_ActivityAgentProfileViewController.m
  5. +108 −61 AgentBridge/ABridge_ActivityPagesViewController.m
  6. +8 −8 AgentBridge/ABridge_ActivityViewController.m
  7. +2 −2 AgentBridge/ABridge_AddressViewController.m
  8. +14 −14 AgentBridge/ABridge_AgentInvitesViewController.m
  9. +1 −1 AgentBridge/ABridge_AgentNetworkPagesViewController.m
  10. +67 −31 AgentBridge/ABridge_BrokerageViewController.m
  11. +1 −1 AgentBridge/ABridge_BuyerPopsViewController.m
  12. +12 −12 AgentBridge/ABridge_ContactInfoViewController.m
  13. +220 −186 AgentBridge/ABridge_FeeCollectionViewController.m
  14. +2 −2 AgentBridge/ABridge_LoginViewController.m
  15. +14 −10 AgentBridge/ABridge_MenuViewController.m
  16. +6 −6 AgentBridge/ABridge_PropertyPagesViewController.m
  17. +2 −2 AgentBridge/ABridge_PropertyViewController.m
  18. +69 −58 AgentBridge/ABridge_ReferralPagesViewController.m
  19. +15 −9 AgentBridge/ABridge_ReferralPagesViewController.xib
  20. +2 −1 AgentBridge/ABridge_ReferralViewController.m
  21. +1 −1 AgentBridge/ABridge_SearchViewController.h
  22. +146 −2 AgentBridge/ABridge_SearchViewController.m
  23. +2 −2 AgentBridge/ABridge_SecurityViewController.m
  24. +1 −1 AgentBridge/AgentBridge-Info.plist
  25. +331 −0 AgentBridge/Constants.h
  26. +32 −24 AgentBridge/Main.storyboard
View
4 AgentBridge.xcodeproj/project.pbxproj
@@ -991,7 +991,7 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-lxml2";
PRODUCT_NAME = "$(TARGET_NAME)";
- PROVISIONING_PROFILE = "F183930C-F746-40E3-9F82-6E540EA91501";
+ PROVISIONING_PROFILE = "BFD61837-38B6-4F75-8CF2-09B1C1BE0F6B";
TARGETED_DEVICE_FAMILY = 1;
WRAPPER_EXTENSION = app;
};
@@ -1018,7 +1018,7 @@
ONLY_ACTIVE_ARCH = NO;
OTHER_LDFLAGS = "-lxml2";
PRODUCT_NAME = "$(TARGET_NAME)";
- PROVISIONING_PROFILE = "F183930C-F746-40E3-9F82-6E540EA91501";
+ PROVISIONING_PROFILE = "BFD61837-38B6-4F75-8CF2-09B1C1BE0F6B";
TARGETED_DEVICE_FAMILY = 1;
WRAPPER_EXTENSION = app;
};
View
BIN ...j/project.xcworkspace/xcuserdata/host24_iosdev.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
View
2 AgentBridge/ABridge_ActivityAgentPOPsViewController.m
@@ -166,7 +166,7 @@ - (void)viewDidLoad
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
View
2 AgentBridge/ABridge_ActivityAgentProfileViewController.m
@@ -177,7 +177,7 @@ - (void)viewDidLoad
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
View
169 AgentBridge/ABridge_ActivityPagesViewController.m
@@ -32,6 +32,9 @@ @interface ABridge_ActivityPagesViewController ()
@property (weak, nonatomic) IBOutlet UILabel *labelDescription;
@property (weak, nonatomic) IBOutlet UIButton *buttonDescription;
@property (strong, nonatomic) LoginDetails * loginDetail;
+
+@property (strong, nonatomic) NSString *pricePaid;
+
- (IBAction)buttonActionPressed:(id)sender;
@end
@@ -42,6 +45,7 @@ @implementation ABridge_ActivityPagesViewController
@synthesize urlConnectionRequestAccess;
@synthesize urlConnectionRequestNetwork;
@synthesize loginDetail;
+@synthesize pricePaid;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
@@ -154,7 +158,7 @@ - (void)viewDidLoad
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -325,7 +329,7 @@ - (void)viewDidLoad
}];
[requestA setFailedBlock:^{
NSError *error = [requestA error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestA startAsynchronous];
@@ -378,7 +382,7 @@ - (void)viewDidLoad
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -505,6 +509,9 @@ - (void)viewDidLoad
self.labelActivityName.text = [NSString stringWithFormat:@"Referral %@ Update",encryptBuyerName];
}
}
+ else {
+ self.labelActivityName.text = [NSString stringWithFormat:@"Referral %@ Update",self.activityDetail.referral_buyer_name];
+ }
if ([self.activityDetail.referral_response integerValue]) {
message_block = [NSString stringWithFormat:@"You have accepted %@'s %@ referral on %@. %@'s contact will be released once you have signed the Referral Agreement.", user_name, self.activityDetail.referral_fee, buyer_block,buyer_block];
@@ -533,16 +540,16 @@ - (void)viewDidLoad
NSString *htmlString = [NSString stringWithFormat:@"<html><head><style>body{font-family:'OpenSans'} a{text-decoration: none; color:#2C99CE;}</style></head><body>%@</body></html>", message_block];
// dispatch_async(dispatch_get_main_queue(), ^{
- CGSize constraint = CGSizeMake(200.0f - 20.0f, 20000.0f);
+ CGSize constraint = CGSizeMake(200.0f - 0.0f, 20000.0f);
CGSize size = [self.labelActivityName.text sizeWithFont:FONT_OPENSANS_REGULAR(FONT_SIZE_REGULAR) constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
- CGFloat height = MAX(size.height, 21.0f);
+ CGFloat height = MAX(size.height, FONT_SIZE_REGULAR);
CGRect frame = self.labelActivityName.frame;
frame.size.height = height;
self.labelActivityName.frame = frame;
-
+// NSLog(@"height:%f",height);
frame = self.labelDateTime.frame;
frame.origin.y = self.labelActivityName.frame.origin.y + self.labelActivityName.frame.size.height + 5.0f;
self.labelDateTime.frame = frame;
@@ -555,7 +562,7 @@ - (void)viewDidLoad
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -599,11 +606,51 @@ - (void)viewDidLoad
message = [NSString stringWithFormat:@"%@ has now closed your referral %@. AgentBridge will now be collecting a service fee.", user_name,buyer_name];
dispatch_async(dispatch_get_main_queue(), ^{
// self.viewForDescription.hidden = NO;
+ NSString *parameters = [NSString stringWithFormat:@"?referral_id=%@", self.activityDetail.referral_id];
+
+ NSString *urlString = [NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/get_closed_referral.php%@", parameters];
+
+
+ // //NSLog(@"urlString:%@",urlString);
+ __block NSError *errorData = nil;
+ __weak ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:urlString]];
+ [request setCompletionBlock:^{
+ // Use when fetching text data
+ // NSString *responseString = [request responseString];
+ // Use when fetching binary data
+ NSData *responseData = [request responseData];
+ NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:&errorData];
+
+ // //NSLog(@"json:%@",json);
+ if([[json objectForKey:@"data"] count]){
+
+ if ([[[[json objectForKey:@"data"] firstObject] valueForKey:@"r1_paid"] boolValue] == YES) {
+
+ self.labelDescription.hidden = NO;
+ self.buttonDescription.hidden = YES;
+
+ self.labelDescription.text = @"Thank you for the payment. You may now change the status of the Referral to Completed.";
+ }
+ else {
+ self.pricePaid = [[[json objectForKey:@"data"] firstObject] valueForKey:@"price_paid"];
+
+ self.labelDescription.hidden = YES;
+ self.buttonDescription.hidden = NO;
+ [self.buttonDescription setTitle:@"Pay" forState:UIControlStateNormal];
+ self.buttonDescription.tag = 1901;
+ }
+
+ }
+
+ }];
+ [request setFailedBlock:^{
+ NSError *error = [request error];
+ NSLog(@" error:%@",error);
+
+ }];
+ [request startAsynchronous];
+
- self.labelDescription.hidden = YES;
- self.buttonDescription.hidden = NO;
- [self.buttonDescription setTitle:@"Pay" forState:UIControlStateNormal];
- self.buttonDescription.tag = 1901;
});}
break;
case 5:
@@ -663,7 +710,7 @@ - (void)viewDidLoad
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -902,11 +949,11 @@ - (void)viewDidLoad
}
dispatch_async(dispatch_get_main_queue(), ^{
- CGSize constraint = CGSizeMake(200.0f - 20.0f, 20000.0f);
+ CGSize constraint = CGSizeMake(200.0f - 0.0f, 20000.0f);
CGSize size = [self.labelActivityName.text sizeWithFont:FONT_OPENSANS_REGULAR(FONT_SIZE_REGULAR) constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
- CGFloat height = MAX(size.height, 21.0f);
+ CGFloat height = MAX(size.height, FONT_SIZE_REGULAR);
CGRect frame = self.labelActivityName.frame;
frame.size.height = height;
@@ -1202,7 +1249,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
}
- (IBAction)buttonActionPressed:(id)sender {
-// //NSLog(@"pressed:%i",[((UIButton*)sender) tag]);
+// NSLog(@"pressed:%i",[((UIButton*)sender) tag]);
switch ([((UIButton*)sender) tag]) {
case 2501:{
@@ -1237,7 +1284,7 @@ - (IBAction)buttonActionPressed:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -1281,7 +1328,7 @@ - (IBAction)buttonActionPressed:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -1330,7 +1377,7 @@ - (IBAction)buttonActionPressed:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -1369,7 +1416,7 @@ - (IBAction)buttonActionPressed:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -1409,7 +1456,7 @@ - (IBAction)buttonActionPressed:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -1450,7 +1497,7 @@ - (IBAction)buttonActionPressed:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -1459,32 +1506,32 @@ - (IBAction)buttonActionPressed:(id)sender {
case 1901:{
- NSString *parameters = [NSString stringWithFormat:@"?referral_id=%@", self.activityDetail.referral_id];
-
- NSString *urlString = [NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/get_closed_referral.php%@", parameters];
-
-
-// //NSLog(@"urlString:%@",urlString);
- __block NSError *errorData = nil;
- __weak ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:urlString]];
- [request setCompletionBlock:^{
- // Use when fetching text data
- // NSString *responseString = [request responseString];
- // Use when fetching binary data
- NSData *responseData = [request responseData];
- NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:&errorData];
-
-// //NSLog(@"json:%@",json);
- if([[json objectForKey:@"data"] count]){
-
- if ([[[[json objectForKey:@"data"] firstObject] valueForKey:@"r2_paid"] boolValue] == YES) {
-
- self.labelDescription.hidden = NO;
- self.buttonDescription.hidden = YES;
-
- self.labelDescription.text = @"Thank you for the payment. You may now change the status of the Referral to Completed.";
- }
- else {
+// NSString *parameters = [NSString stringWithFormat:@"?referral_id=%@", self.activityDetail.referral_id];
+//
+// NSString *urlString = [NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/get_closed_referral.php%@", parameters];
+//
+//
+//// //NSLog(@"urlString:%@",urlString);
+// __block NSError *errorData = nil;
+// __weak ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:urlString]];
+// [request setCompletionBlock:^{
+// // Use when fetching text data
+// // NSString *responseString = [request responseString];
+// // Use when fetching binary data
+// NSData *responseData = [request responseData];
+// NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:&errorData];
+//
+//// //NSLog(@"json:%@",json);
+// if([[json objectForKey:@"data"] count]){
+//
+// if ([[[[json objectForKey:@"data"] firstObject] valueForKey:@"r2_paid"] boolValue] == YES) {
+//
+// self.labelDescription.hidden = NO;
+// self.buttonDescription.hidden = YES;
+//
+// self.labelDescription.text = @"Thank you for the payment. You may now change the status of the Referral to Completed.";
+// }
+// else {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ABridge_FeeCollectionViewController *viewController = (ABridge_FeeCollectionViewController*)[storyboard instantiateViewControllerWithIdentifier:@"FeeCollection"];
viewController.modalPresentationStyle = UIModalPresentationFullScreen;
@@ -1495,23 +1542,23 @@ - (IBAction)buttonActionPressed:(id)sender {
viewController.user_id = self.loginDetail.user_id;
viewController.delegate = self;
viewController.referral_fee = [self.activityDetail.referral_fee floatValue]/100.0f;
- viewController.grossCommissionValue = [[[json objectForKey:@"data"] firstObject] valueForKey:@"price_paid"];
+ viewController.grossCommissionValue = self.pricePaid;
// //NSLog(@"gross:%@",[[[json objectForKey:@"data"] firstObject] valueForKey:@"price_paid"]);
[self presentViewController:viewController animated:YES completion:^{
}];
- }
-
- }
-
- }];
- [request setFailedBlock:^{
- NSError *error = [request error];
- //NSLog(@"error:%@",error);
-
- }];
- [request startAsynchronous];
+// }
+//
+// }
+//
+// }];
+// [request setFailedBlock:^{
+// NSError *error = [request error];
+// NSLog(@" error:%@",error);
+//
+// }];
+// [request startAsynchronous];
break;
@@ -1526,7 +1573,7 @@ - (IBAction)buttonActionPressed:(id)sender {
- (void)transactionCompletedSuccessfully {
- NSString *parameters = [NSString stringWithFormat:@"?user_id=%@&agent_a=%@&activity_type=%@&update_id=%@", self.loginDetail.user_id, self.activityDetail.user_id,@"22",self.activityDetail.referral_update_id];
+ NSString *parameters = [NSString stringWithFormat:@"?user_id=%@&agent_a=%@&activity_type=%@&update_id=%@&buyer_id=%@", self.loginDetail.user_id, self.activityDetail.user_id,@"22",self.activityDetail.referral_update_id,self.activityDetail.buyer_id];
NSString *urlString = [NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/paid_service_fee.php%@", parameters];
@@ -1552,7 +1599,7 @@ - (void)transactionCompletedSuccessfully {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
View
16 AgentBridge/ABridge_ActivityViewController.m
@@ -191,7 +191,6 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
NSDictionary *jsonActivities = [NSJSONSerialization JSONObjectWithData:self.dataReceived options:NSJSONReadingAllowFragments error:&error];
-// //NSLog(@"Did Finish:%@", jsonActivities);
if ([[jsonActivities objectForKey:@"data"] count]) {
// //NSLog(@"total:%i",[[json objectForKey:@"data"] count]);
for (NSDictionary *entryActivities in [jsonActivities objectForKey:@"data"]) {
@@ -201,6 +200,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
NSString *urlString = [NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/getactivity-%@.php%@", [entryActivities valueForKey:@"activity_type"], parameters];
+// NSLog(@"Did Finish:%@", urlString);
self.activityIndicator.hidden = NO;
[self.activityIndicator startAnimating];
__block NSError *errorData = nil;
@@ -252,12 +252,12 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
[self.arrayOfActivity replaceObjectAtIndex:[[jsonActivities objectForKey:@"data"] indexOfObject:entryActivities] withObject:activity];
}
- NSSortDescriptor *sortDescriptor;
- sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"date"
- ascending:NO];
- NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
- NSArray *sortedArray;
- sortedArray = [self.arrayOfActivity sortedArrayUsingDescriptors:sortDescriptors];
+// NSSortDescriptor *sortDescriptor;
+// sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"date"
+// ascending:NO];
+// NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
+// NSArray *sortedArray;
+// sortedArray = [self.arrayOfActivity sortedArrayUsingDescriptors:sortDescriptors];
self.numberOfActivity = [self.arrayOfActivity count];
self.labelNumberOfActivity.text = [NSString stringWithFormat:@"My Activity (%li)",(long)self.numberOfActivity];
@@ -279,7 +279,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@"11 error:%@",error);
+ NSLog(@"11 error:%@",error);
[self.activityIndicator stopAnimating];
self.activityIndicator.hidden = YES;
}];
View
4 AgentBridge/ABridge_AddressViewController.m
@@ -184,7 +184,7 @@ - (void)viewDidLoad
}];
[requestCountry setFailedBlock:^{
NSError *error = [requestCountry error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestCountry startAsynchronous];
@@ -225,7 +225,7 @@ - (void)viewDidLoad
}];
[requestState setFailedBlock:^{
NSError *error = [requestState error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestState startAsynchronous];
View
28 AgentBridge/ABridge_AgentInvitesViewController.m
@@ -64,21 +64,21 @@ - (void)viewDidLoad
self.buttonSend.enabled = NO;
NSManagedObjectContext *context = ((ABridge_AppDelegate *)[[UIApplication sharedApplication] delegate]).managedObjectContext;
- NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
- NSEntityDescription *entity = [NSEntityDescription entityForName:@"LoginDetails" inManagedObjectContext:context];
- [fetchRequest setEntity:entity];
- NSError *error = nil;
- NSArray *fetchedObjects = [context
- executeFetchRequest:fetchRequest error:&error];
+// NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
+// NSEntityDescription *entity = [NSEntityDescription entityForName:@"LoginDetails" inManagedObjectContext:context];
+// [fetchRequest setEntity:entity];
+// NSError *error = nil;
+// NSArray *fetchedObjects = [context
+// executeFetchRequest:fetchRequest error:&error];
- fetchRequest = [[NSFetchRequest alloc] init];
- entity = [NSEntityDescription entityForName:@"AgentProfile"
+ NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
+ NSEntityDescription *entity = [NSEntityDescription entityForName:@"AgentProfile"
inManagedObjectContext:context];
[fetchRequest setEntity:entity];
- error = nil;
- fetchedObjects = nil;
- fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
+ NSError *error = nil;
+// fetchedObjects = nil;
+ NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
for (AgentProfile *profile in fetchedObjects) {
if ([profile.user_id integerValue] == [[[fetchedObjects firstObject] valueForKey:@"user_id"] integerValue]) {
@@ -137,7 +137,7 @@ - (void) checkInvites {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@"25 error:%@",error);
+ NSLog(@"25 error:%@",error);
}];
[request startAsynchronous];
@@ -191,7 +191,7 @@ - (IBAction)sendInvite:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@"25 error:%@",error);
+ NSLog(@"25 error:%@",error);
}];
[request startAsynchronous];
@@ -233,7 +233,7 @@ - (void) submit {
}];
[requestSend setFailedBlock:^{
NSError *error = [requestSend error];
- //NSLog(@"25 error:%@",error);
+ NSLog(@"25 error:%@",error);
}];
[requestSend startAsynchronous];
View
2 AgentBridge/ABridge_AgentNetworkPagesViewController.m
@@ -185,7 +185,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
text = self.profileData.broker_name;
}
else if ([[self.arrayKTableKeys objectAtIndex:[indexPath row]] isEqualToString:@"address"]) {
- text = @"";
+// text = @"";
NSMutableString *string = [NSMutableString stringWithString:@""];
if (![self isNull:self.profileData.street_address]) {
[string appendFormat:@"%@\n",self.profileData.street_address];
View
98 AgentBridge/ABridge_BrokerageViewController.m
@@ -105,13 +105,28 @@ - (void)viewDidLoad
[self addPaddingAndBorder:self.textFieldBroker_label color:[UIColor colorWithRed:178.0f/255.0f green:178.0f/255.0f blue:178.0f/255.0f alpha:1.0f]];
+
+
+ // Set the anchor point and center so the view swings from the upper right
+// self.buttonDeleteBroker.layer.anchorPoint = CGPointMake(1.0, 0.0);
+// self.buttonDeleteBroker.center = CGPointMake(CGRectGetWidth(self.view.bounds), 0.0);
+
+ // Rotate 90 degrees to hide it off screen
+// CGAffineTransform rotationTransform = CGAffineTransformIdentity;
+// rotationTransform = CGAffineTransformRotate(rotationTransform, M_PI_4);
+// self.buttonDeleteBroker.transform = rotationTransform;
+
+
+
CGRect frame = self.buttonDeleteBroker.frame;
frame.size.height = 20.0f;
frame.size.width = 20.0f;
self.buttonDeleteBroker.frame = frame;
-
+
self.buttonDeleteBroker.transform = CGAffineTransformMakeRotation(M_PI_4);
+
+
// self.labelBroker.layer.borderWidth = 1.0f;
// self.labelBroker.layer.borderColor = [UIColor colorWithRed:178.0f/255.0f green:178.0f/255.0f blue:178.0f/255.0f alpha:1.0f].CGColor;
@@ -182,7 +197,7 @@ - (void)viewDidLoad
}];
[requestBroker setFailedBlock:^{
NSError *error = [requestBroker error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestBroker startAsynchronous];
@@ -227,7 +242,7 @@ - (void)viewDidLoad
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -327,10 +342,11 @@ - (void)viewDidLoad
}];
[requestUserDesignation setFailedBlock:^{
NSError *error = [requestUserDesignation error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestUserDesignation startAsynchronous];
+
}
- (void)viewWillDisappear:(BOOL)animated {
@@ -386,7 +402,7 @@ - (IBAction)saveBrokerage:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -431,7 +447,7 @@ - (IBAction)saveBrokerage:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -483,7 +499,7 @@ - (IBAction)saveBrokerage:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -554,29 +570,19 @@ - (void) addDesignationLabel:(NSDictionary*)entry{//(NSString*)name {
[self.arrayOfUserDesignation addObject:entry];
-// if ([self.arrayOfUserDesignation count] > 2) {
-// CGRect frame = self.tableViewDesignations.frame;
-// frame.size.height += 30.0f;
-// self.tableViewDesignations.frame = frame;
-//
-// frame = self.buttonSave.frame;
-// frame.origin.y += 30.0f;
-// self.buttonSave.frame = frame;
-// }
-
-
- if (self.tableViewDesignations.frame.size.height + self.tableViewDesignations.frame.origin.y + 10.0f < self.viewContent.frame.size.height - 140.0f) {
- if (self.tableViewDesignations.contentSize.height > self.tableViewDesignations.frame.size.height) {
- CGRect frame = self.tableViewDesignations.frame;
- frame.size.height = self.tableViewDesignations.contentSize.height;
- self.tableViewDesignations.frame = frame;
-
- frame = self.buttonSave.frame;
- frame.origin.y = self.tableViewDesignations.frame.size.height + self.tableViewDesignations.frame.origin.y + 10.0f;
- self.buttonSave.frame = frame;
-
- }
- }
+//
+// if (self.tableViewDesignations.contentSize.height > self.tableViewDesignations.frame.size.height) {
+// CGRect frame = self.tableViewDesignations.frame;
+// frame.size.height = self.tableViewDesignations.contentSize.height;
+// self.tableViewDesignations.frame = frame;
+//
+// frame = self.buttonSave.frame;
+// frame.origin.y = self.tableViewDesignations.frame.size.height + self.tableViewDesignations.frame.origin.y + 10.0f;
+// self.buttonSave.frame = frame;
+//
+// }
+//
+// NSLog(@"height:%f > %f",self.tableViewDesignations.contentSize.height, self.tableViewDesignations.frame.size.height);
[self.tableViewDesignations reloadData];
@@ -724,6 +730,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
CGFloat height = MAX(size.height, 30.0f);
+
return height + 10.0f;
}
@@ -758,7 +765,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
button.frame = CGRectMake(label.frame.origin.x + label.frame.size.width + 2.0f, 5.0f, 20.0f, 20.0f);
button.tag = 2;
- self.buttonDeleteBroker.transform = CGAffineTransformMakeRotation(M_PI_4);
+ button.transform = CGAffineTransformMakeRotation(M_PI_4);
[button addTarget:self action:@selector(removeDesignation:) forControlEvents:UIControlEventTouchUpInside];
@@ -802,6 +809,35 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
center.y = label.frame.size.height/2.0f;
button.center = center;
+ CGFloat buttonFrameLimit = self.viewContent.frame.size.height - (self.buttonSave.frame.size.height + 10.0f);
+
+ if ( self.tableViewDesignations.contentSize.height > self.tableViewDesignations.frame.size.height - 20.0f) {
+ [self.tableViewDesignations beginUpdates];
+ if (buttonFrameLimit > self.tableViewDesignations.contentSize.height + self.tableViewDesignations.frame.origin.y) {
+
+ CGRect frame = self.tableViewDesignations.frame;
+ frame.size.height = self.tableViewDesignations.contentSize.height;
+ self.tableViewDesignations.frame = frame;
+
+ frame = self.buttonSave.frame;
+ frame.origin.y = self.tableViewDesignations.frame.size.height + self.tableViewDesignations.frame.origin.y + 10.0f;
+ self.buttonSave.frame = frame;
+ }
+ else {
+ CGRect frame = self.tableViewDesignations.frame;
+ frame.size.height = self.tableViewDesignations.contentSize.height - 20.0f;
+ self.tableViewDesignations.frame = frame;
+
+ frame = self.buttonSave.frame;
+ frame.origin.y = buttonFrameLimit;
+ self.buttonSave.frame = frame;
+ }
+
+ [self.tableViewDesignations endUpdates];
+ }
+
+// NSLog(@"%f %f", buttonFrameLimit,self.tableViewDesignations.contentSize.height + self.tableViewDesignations.frame.origin.y);
+
return cell;
}
View
2 AgentBridge/ABridge_BuyerPopsViewController.m
@@ -446,7 +446,7 @@ - (IBAction)saveButtonPressed:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
View
24 AgentBridge/ABridge_ContactInfoViewController.m
@@ -186,7 +186,7 @@ - (void) fetchContactData {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -259,7 +259,7 @@ - (void) fetchContactData {
}];
[requestFax setFailedBlock:^{
NSError *error = [requestFax error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestFax startAsynchronous];
@@ -333,7 +333,7 @@ - (void) fetchContactData {
}];
[requestWork setFailedBlock:^{
NSError *error = [requestWork error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestWork startAsynchronous];
@@ -396,7 +396,7 @@ - (IBAction)saveContacts:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -440,7 +440,7 @@ - (IBAction)saveContacts:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -485,7 +485,7 @@ - (IBAction)saveContacts:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -533,7 +533,7 @@ - (IBAction)saveContacts:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -568,7 +568,7 @@ - (IBAction)saveContacts:(id)sender {
// }];
// [request setFailedBlock:^{
// NSError *error = [request error];
-// //NSLog(@" error:%@",error);
+// NSLog(@" error:%@",error);
// }];
//
// [request startAsynchronous];
@@ -614,7 +614,7 @@ - (IBAction)saveContacts:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -649,7 +649,7 @@ - (IBAction)saveContacts:(id)sender {
// }];
// [request setFailedBlock:^{
// NSError *error = [request error];
-// //NSLog(@" error:%@",error);
+// NSLog(@" error:%@",error);
// }];
//
// [request startAsynchronous];
@@ -700,7 +700,7 @@ - (IBAction)saveContacts:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -735,7 +735,7 @@ - (IBAction)saveContacts:(id)sender {
// }];
// [request setFailedBlock:^{
// NSError *error = [request error];
-// //NSLog(@" error:%@",error);
+// NSLog(@" error:%@",error);
// }];
//
// [request startAsynchronous];
View
406 AgentBridge/ABridge_FeeCollectionViewController.m
@@ -77,12 +77,17 @@ @interface ABridge_FeeCollectionViewController ()
@property (strong, nonatomic) NSString *sessionToken;
-@property (strong, nonatomic) UIWebView *webView;
+@property (strong, nonatomic) UIWebView *webViewInvoice;
+@property (strong, nonatomic) UIWebView *webViewPayment;
@property (assign, nonatomic) NSInteger webViewHeight;
@property (assign, nonatomic) NSInteger imageName;
@property (strong, nonatomic) LoginDetails *loginDetails;
+@property (strong, nonatomic) AgentProfile *profile;
+
+@property (strong, nonatomic) NSString *invoice_number;
+@property (strong, nonatomic) NSString *payment_id;
- (IBAction)continuePressed:(id)sender;
- (IBAction)cancelPressed:(id)sender;
@@ -115,11 +120,15 @@ @implementation ABridge_FeeCollectionViewController
@synthesize referral_name;
@synthesize grossCommissionValue;
@synthesize referral_fee;
-@synthesize webView;
+@synthesize webViewInvoice;
+@synthesize webViewPayment;
@synthesize webViewHeight;
@synthesize imageName;
@synthesize loginDetails;
+@synthesize profile;
+@synthesize invoice_number;
+@synthesize payment_id;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
@@ -282,7 +291,7 @@ - (void)viewDidLoad
}];
[requestCountry setFailedBlock:^{
NSError *error = [requestCountry error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestCountry startAsynchronous];
@@ -332,7 +341,7 @@ - (void)viewDidLoad
}];
[requestState setFailedBlock:^{
NSError *error = [requestState error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestState startAsynchronous];
@@ -371,10 +380,10 @@ - (void)viewDidLoad
[fetchRequestProfile setPredicate:predicate];
NSError *errorProfile = nil;
- AgentProfile *profile = (AgentProfile*)[[context executeFetchRequest:fetchRequestProfile error:&errorProfile] firstObject];
+ self.profile = (AgentProfile*)[[context executeFetchRequest:fetchRequestProfile error:&errorProfile] firstObject];
- NSString *parameter = [NSString stringWithFormat:@"?text=%@",[[profile.licence stringByReplacingOccurrencesOfString:@"+" withString:@"%2B"] stringByReplacingOccurrencesOfString:@"=" withString:@"%3D"]];
+ NSString *parameter = [NSString stringWithFormat:@"?text=%@",[[self.profile.licence stringByReplacingOccurrencesOfString:@"+" withString:@"%2B"] stringByReplacingOccurrencesOfString:@"=" withString:@"%3D"]];
NSMutableString *urlStringDecrypt = [NSMutableString stringWithString:@"http://keydiscoveryinc.com/agent_bridge/webservice/decrypt_license.php"];
[urlStringDecrypt appendString:parameter];
@@ -403,12 +412,12 @@ - (void)viewDidLoad
}];
[requestDecrypt setFailedBlock:^{
NSError *error = [requestDecrypt error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestDecrypt startAsynchronous];
- parameter = [NSString stringWithFormat:@"?text=%@",[[profile.brokerage_license stringByReplacingOccurrencesOfString:@"+" withString:@"%2B"] stringByReplacingOccurrencesOfString:@"=" withString:@"%3D"]];
+ parameter = [NSString stringWithFormat:@"?text=%@",[[self.profile.brokerage_license stringByReplacingOccurrencesOfString:@"+" withString:@"%2B"] stringByReplacingOccurrencesOfString:@"=" withString:@"%3D"]];
[urlStringDecrypt setString:@"http://keydiscoveryinc.com/agent_bridge/webservice/decrypt_license.php"];
[urlStringDecrypt appendString:parameter];
@@ -436,13 +445,13 @@ - (void)viewDidLoad
}];
[requestDecrypt setFailedBlock:^{
NSError *error = [requestDecrypt error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestDecrypt startAsynchronous];
- parameter = [NSString stringWithFormat:@"?text=%@",[[profile.tax_id_num stringByReplacingOccurrencesOfString:@"+" withString:@"%2B"] stringByReplacingOccurrencesOfString:@"=" withString:@"%3D"]];
+ parameter = [NSString stringWithFormat:@"?text=%@",[[self.profile.tax_id_num stringByReplacingOccurrencesOfString:@"+" withString:@"%2B"] stringByReplacingOccurrencesOfString:@"=" withString:@"%3D"]];
[urlStringDecrypt setString:@"http://keydiscoveryinc.com/agent_bridge/webservice/decrypt_license.php"];
[urlStringDecrypt appendString:parameter];
@@ -470,20 +479,20 @@ - (void)viewDidLoad
}];
[requestDecrypt setFailedBlock:^{
NSError *error = [requestDecrypt error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestDecrypt startAsynchronous];
- UITapGestureRecognizer *tapViewInfo = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(resizeViewInfo)];
- tapViewInfo.numberOfTapsRequired = 1;
- tapViewInfo.numberOfTouchesRequired = 1;
- [self.viewInfo addGestureRecognizer:tapViewInfo];
-
- UITapGestureRecognizer *tapTextView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(resizeTextViewTop)];
- tapTextView.numberOfTapsRequired = 1;
- tapTextView.numberOfTouchesRequired = 1;
- [self.view addGestureRecognizer:tapTextView];
+// UITapGestureRecognizer *tapViewInfo = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(resizeViewInfo)];
+// tapViewInfo.numberOfTapsRequired = 1;
+// tapViewInfo.numberOfTouchesRequired = 1;
+// [self.viewInfo addGestureRecognizer:tapViewInfo];
+//
+// UITapGestureRecognizer *tapTextView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(resizeTextViewTop)];
+// tapTextView.numberOfTapsRequired = 1;
+// tapTextView.numberOfTouchesRequired = 1;
+// [self.view addGestureRecognizer:tapTextView];
if (self.grossCommissionValue != nil && [self.grossCommissionValue isEqualToString:@""] == NO) {
UIButton *sender = [[UIButton alloc] init];
@@ -497,6 +506,8 @@ - (void)viewDidLoad
[self continuePressed:sender];
}
+
+ self.textViewTop.showsHorizontalScrollIndicator = YES;
}
- (void)didReceiveMemoryWarning
@@ -550,14 +561,6 @@ - (void) resizeTextViewTop {
}
- (IBAction)continuePressed:(id)sender {
-
-// NSString *htmlStringForPDF = [NSString stringWithFormat:@"<html><head><title>Agent Bridge Mobile</title></head><body><div><table><tr><td colspan=2 ></td><td colspan=2 ><strong>Invoice</strong></td></tr><tr><td> <strong>Bill To: %@</strong> </td><td> </td><td colspan=2 > <strong>Customer Information</strong> </td></tr><tr><td> </td><td> <ul><li>Bighor Golf Club</li><li>Giuletta Masina</li><li>Rodeo Drive</li><li>Beverly Hills, California 90210</li><li>United States</li></ul></td><td> <ul><li>Invoice No.</li><li>Customer Name:</li><li>Customer ID:</li></ul></td><td> <ul><li>Fee_1158_1_45</li><li>Referral One</li><li>0000000021</li></ul></td></tr></table></br></div></body></html>",self.grossCommission];
-//
-// self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 1024.0f, 768.0f)];
-// self.webView.delegate = self;
-// [webView loadHTMLString:htmlStringForPDF baseURL:nil];
-
-
BOOL continueToNextView = NO;
switch ([sender tag]) {
@@ -599,7 +602,13 @@ - (IBAction)continuePressed:(id)sender {
// //NSLog(@"json:%@",json);
if ([[json objectForKey:@"data"] count]) {
- self.serviceFee = [[[json objectForKey:@"data"] firstObject]objectForKey:@"r2_fee"];
+
+ if (self.grossCommissionValue != nil && [self.grossCommissionValue isEqualToString:@""] == NO) {
+ self.serviceFee = [[[json objectForKey:@"data"] firstObject]objectForKey:@"r1_fee"];
+ }
+ else {
+ self.serviceFee = [[[json objectForKey:@"data"] firstObject]objectForKey:@"r2_fee"];
+ }
NSNumberFormatter * formatter = [[NSNumberFormatter alloc] init];
formatter.numberStyle = NSNumberFormatterCurrencyStyle;
[formatter setMaximumFractionDigits:0];
@@ -613,19 +622,19 @@ - (IBAction)continuePressed:(id)sender {
self.textViewTop.text = [NSString stringWithFormat:@"The %@ referral fee of %@ is ready to to be disbursed.\nAgentBridge will now be collecting the service fee of %@.\n\nGross Commission of %@: %@", self.referral_name, [formatter stringFromNumber: [NSNumber numberWithDouble:([self.grossCommission doubleValue] * self.referral_fee)]], [formatter stringFromNumber: [NSNumber numberWithDouble:[self.serviceFee doubleValue]]], self.loginDetails.name, [formatter stringFromNumber: [NSNumber numberWithDouble:[self.grossCommission doubleValue]]]];
- CGSize constraint = CGSizeMake(self.textViewTop.frame.size.width - 10.0f, 20000.0f);
-
- CGSize size = [self.textViewTop.text sizeWithFont:FONT_OPENSANS_REGULAR(FONT_SIZE_REGULAR) constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
-
- CGFloat height = MAX(size.height, FONT_SIZE_REGULAR);
-
- CGRect frame = self.textViewTop.frame;
- frame.size.height = height + 20.0f;
- self.textViewTop.frame = frame;
-
- frame = self.viewInfo.frame;
- frame.origin.y = self.textViewTop.frame.size.height + self.textViewTop.frame.origin.y;
- self.viewInfo.frame = frame;
+// CGSize constraint = CGSizeMake(self.textViewTop.frame.size.width - 10.0f, 20000.0f);
+//
+// CGSize size = [self.textViewTop.text sizeWithFont:FONT_OPENSANS_REGULAR(FONT_SIZE_REGULAR) constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];
+//
+// CGFloat height = MAX(size.height, FONT_SIZE_REGULAR);
+//
+// CGRect frame = self.textViewTop.frame;
+// frame.size.height = height + 20.0f;
+// self.textViewTop.frame = frame;
+//
+// frame = self.viewInfo.frame;
+// frame.origin.y = self.textViewTop.frame.size.height + self.textViewTop.frame.origin.y;
+// self.viewInfo.frame = frame;
}
else {
@@ -637,7 +646,7 @@ - (IBAction)continuePressed:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -836,7 +845,7 @@ - (IBAction)submitTransaction:(id)sender {
NSMutableString *urlString = [NSMutableString stringWithString:@"http://keydiscoveryinc.com/agent_bridge/webservice/send_transaction.php"];
[urlString appendString:parameters];
- //NSLog(@"url:%@",urlString);
+ NSLog(@"url:%@",urlString);
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
@@ -848,28 +857,30 @@ - (IBAction)submitTransaction:(id)sender {
^{
NSData *responseData = [request responseData];
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:&errorData];
- //NSLog(@"json:%@",json);
+ NSLog(@"json:%@",json);
if ([[json objectForKey:@"status"] integerValue] == YES) {
- UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Transaction Successful" message:@"Your Transaction has completed Successfully!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
- av.tag = 99;
- [av show];
+ self.invoice_number = [[json objectForKey:@"data"] objectForKey:@"invoice_number"];
+ [self createInvoicePDF];
}
else if ([json objectForKey:@"error"] != nil) {
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Transaction Failed" message:[[json objectForKey:@"error"] substringFromIndex:[[json objectForKey:@"error"] rangeOfString:@"Response Reason Text:"].location+21] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[av show];
+ [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
+ [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
+ self.buttonSubmit.enabled = YES;
}
else {
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Transaction Failed" message:@"Something went wrong in your Transaction." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[av show];
+ [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
+ [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
+ self.buttonSubmit.enabled = YES;
}
- [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
- [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
- self.buttonSubmit.enabled = YES;
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Transaction Failed" message:@"Received an Error in connection." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[av show];
@@ -913,93 +924,6 @@ - (IBAction)submitTransaction:(id)sender {
self.buttonSubmit.enabled = YES;
}
-
-
-// ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL: [[NSURL alloc] initWithString:@"http://keydiscoveryinc.com/agent_bridge/components/com_propertylisting/controller.php"]];
-// [request setResponseEncoding:NSISOLatin1StringEncoding];
-// [request setPostFormat:ASIMultipartFormDataPostFormat];
-// [request setPostValue:self.textFieldGrossComission.text forKey:@"amount"];
-// [request setPostValue:[NSString stringWithFormat:@"%li",(long)referral_id] forKey:@"ref_id"];
-// [request setPostValue:self.textFieldEmail.text forKey:@"email"];
-// [request setPostValue:[NSString stringWithFormat:@"%@,%@",self.textFieldAddress1.text,self.textFieldAddress2.text] forKey:@"address"];
-// [request setPostValue:@"223" forKey:@"city"];
-// [request setPostValue:@"12" forKey:@"state"];
-// [request setPostValue:self.textFieldZipcode.text forKey:@"zip"];
-// [request setPostValue:self.textFieldFirstname.text forKey:@"firstname"];
-// [request setPostValue:self.textFieldLastname.text forKey:@"lastname"];
-// [request setPostValue:self.textFieldPhoneNumber.text forKey:@"phone"];
-// [request setPostValue:@"BL29231" forKey:@"bslno"];
-// [request setPostValue:@"AB9301838" forKey:@"alslno"];
-// [request setPostValue:self.textFieldTaxId.text forKey:@"btino"];
-// [request setPostValue:self.cardExpiry forKey:@"card_expiry"];
-// [request setPostValue:self.textFieldCreditCard.text forKey:@"card_number"];
-// [request setPostValue:self.textFieldSecurityCode.text forKey:@"security_no"];
-// [request setPostValue:[NSString stringWithFormat:@"%i",self.switchAgree.isOn] forKey:@"agree_terms"];
-// [request setPostValue:@"0" forKey:@"save_trans"];
-// [request setPostValue:@"Submit" forKey:@"send"];
-//
-// [request setCompletionBlock:^{
-// // Use when fetching text data
-// NSString *responseString = [request responseString];
-// // Use when fetching binary data
-// NSError *errorData = nil;
-// NSData *responseData = [request responseData];
-// NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:&errorData];
-//
-//// //NSLog(@"%@\njson,%@",responseString,json);
-//
-// [self dismissViewControllerAnimated:YES completion:^{
-//
-// }];
-//
-// }];
-// [request setFailedBlock:^{
-// NSError *error = [request error];
-// //NSLog(@"error:%@",error);
-//
-// }];
-// [request startAsynchronous];
-
-// ABridge_SendTransaction *send = [[ABridge_SendTransaction alloc] init];
-// [send loginToGateway];
-
-// NSString *uuid = @"";
-// if ([[NSUserDefaults standardUserDefaults] objectForKey:@"UUID_mobile"] == nil) {
-// [[NSUserDefaults standardUserDefaults] setObject:[[[NSUUID UUID] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@"_"] forKey:@"UUID_mobile"];
-// [[NSUserDefaults standardUserDefaults] synchronize];
-// }
-//
-// uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"UUID_mobile"];
-
-// MobileDeviceRegistrationRequest *registrationRequest=[MobileDeviceRegistrationRequest mobileDeviceRegistrationRequest];
-//
-// registrationRequest.anetApiRequest.merchantAuthentication.name=@"jovhenni19";
-//
-// registrationRequest.anetApiRequest.merchantAuthentication.password = @"Vhengshua19";
-//
-// registrationRequest.mobileDevice.mobileDescription=@"asd";
-// registrationRequest.mobileDevice.mobileDeviceId= uuid;
-// [AuthNet authNetWithEnvironment:ENV_TEST];
-// AuthNet *an = [AuthNet getInstance];
-//
-// [an setDelegate:self];
-
-// [an mobileDeviceRegistrationRequest:registrationRequest];
-
- // Create our login request.
-// MobileDeviceLoginRequest *mobileDeviceLoginRequest = [MobileDeviceLoginRequest mobileDeviceLoginRequest];
-// mobileDeviceLoginRequest.anetApiRequest.merchantAuthentication.name = @"jovhenni19";
-// mobileDeviceLoginRequest.anetApiRequest.merchantAuthentication.password = @"Vhengshua19";
-// mobileDeviceLoginRequest.anetApiRequest.merchantAuthentication.mobileDeviceId = uuid;
-//
-// [AuthNet authNetWithEnvironment:ENV_TEST];
-// AuthNet *an2 = [AuthNet getInstance];
-//
-// [an2 setDelegate:self];
-//
-// [an2 mobileDeviceLoginRequest:mobileDeviceLoginRequest];
-
-// [self createTransaction];
}
- (IBAction)resignKeyboards:(id)sender {
@@ -1164,10 +1088,10 @@ - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComp
NSMutableString *expiry = [NSMutableString stringWithString:@""];
if (component == 0) {
if(row < 9){
- [expiry appendFormat:@"0%li",row+1];
+ [expiry appendFormat:@"0%li",(long)row+1];
}
else {
- [expiry appendFormat:@"%li",row+1];
+ [expiry appendFormat:@"%li",(long)row+1];
}
NSInteger yearRow = [pickerView selectedRowInComponent:1];
@@ -1176,10 +1100,10 @@ - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComp
else {
NSInteger monthRow = [pickerView selectedRowInComponent:0];
if(monthRow < 10){
- [expiry appendFormat:@"0%li",monthRow+1];
+ [expiry appendFormat:@"0%li",(long)monthRow+1];
}
else {
- [expiry appendFormat:@"%li",monthRow+1];
+ [expiry appendFormat:@"%li",(long)monthRow+1];
}
[expiry appendFormat:@"/%@",[[self.arrayOfYear objectAtIndex:row] substringFromIndex:2]];
@@ -1245,10 +1169,10 @@ - (void) hideViewForPickerExpiry {
NSMutableString *expiry = [NSMutableString stringWithString:@""];
if(rowMonth < 10){
- [expiry appendFormat:@"0%li",rowMonth+1];
+ [expiry appendFormat:@"0%li",(long)rowMonth+1];
}
else {
- [expiry appendFormat:@"%li",rowMonth+1];
+ [expiry appendFormat:@"%li",(long)rowMonth+1];
}
[expiry appendFormat:@"/%@",[[self.arrayOfYear objectAtIndex:rowYear] substringFromIndex:2]];
@@ -1295,13 +1219,13 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto
NSString *urlString = @"";
if (self.grossCommissionValue != nil && [self.grossCommissionValue isEqualToString:@""] == NO) {
- //r2
- urlString = [NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/save_closed_referral_r2.php%@", parameters];
- }
- else {
//r1
urlString = [NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/save_closed_referral_r1.php%@", parameters];
}
+ else {
+ //r2
+ urlString = [NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/save_closed_referral_r2.php%@", parameters];
+ }
// NSString *parameters = [NSString stringWithFormat:@"?referral_id=%@&price_paid=%@", self.referral_id, self.grossCommission];
//
@@ -1328,7 +1252,7 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -1341,6 +1265,70 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto
}
}
+- (void) createInvoicePDF {
+
+ NSString *agent_name = [NSString stringWithFormat:@"%@ %@",self.textFieldFirstname.text, self.textFieldLastname.text];
+ NSString *address = @"";
+ if ([self textIsNull:self.textFieldAddress1.text] == NO && [self textIsNull:self.textFieldAddress2.text] == YES) {
+ address = self.textFieldAddress1.text;
+ }
+ else if ([self textIsNull:self.textFieldAddress1.text] == YES && [self textIsNull:self.textFieldAddress2.text] == NO) {
+ address = self.textFieldAddress2.text;
+ }
+ else if ([self textIsNull:self.textFieldAddress1.text] == NO && [self textIsNull:self.textFieldAddress2.text] == NO) {
+ address = [NSString stringWithFormat:@"%@, %@",self.textFieldAddress1.text, self.textFieldAddress2.text];
+ }
+ NSString *cityStateZip = [NSString stringWithFormat:@"%@, %@ %@",self.textFieldCity.text, [self.arrayOfState objectAtIndex:[self.pickerState selectedRowInComponent:0]], self.textFieldZipcode.text];
+
+ NSString *country = [self.arrayOfCountry objectAtIndex:[self.pickerCountry selectedRowInComponent:0]];
+
+ NSDate *today = [NSDate date];
+ NSCalendar *gregorian = [[NSCalendar alloc]
+ initWithCalendarIdentifier:NSGregorianCalendar];
+ NSDateComponents *weekdayComponents = [gregorian components:(NSDayCalendarUnit | NSWeekdayCalendarUnit | NSYearCalendarUnit | NSMonthCalendarUnit) fromDate:today];
+ NSInteger day = [weekdayComponents day];
+ NSInteger month = [weekdayComponents month];
+ NSInteger year = [weekdayComponents year];
+
+ NSString *invoice_date = [NSString stringWithFormat:@"%li-%li-%li",(long)month,(long)day,(long)year];
+ NSString *referrence = [NSString stringWithFormat:@"%@, %@",self.referral_id, self.referral_name];
+
+ NSNumberFormatter * formatter = [[NSNumberFormatter alloc] init];
+ formatter.numberStyle = NSNumberFormatterCurrencyStyle;
+ [formatter setMaximumFractionDigits:0];
+ formatter.currencyCode = @"USD";
+
+ NSString *service_fee = [formatter stringFromNumber: [NSNumber numberWithDouble:[self.serviceFee doubleValue]]];
+
+ NSString *htmlStringForPDF = [NSString stringWithFormat:HTMLSTRING_INVOICE,self.profile.broker_name, agent_name, address, cityStateZip, country, self.profile.broker_name, agent_name, address, cityStateZip, country, invoice_date, self.invoice_number, invoice_date, self.referral_id, invoice_date, invoice_date, referrence, service_fee, service_fee, service_fee, service_fee, self.profile.broker_name, agent_name, address, cityStateZip, country, self.user_id, agent_name, self.invoice_number, invoice_date, service_fee];
+
+ self.webViewInvoice = [[UIWebView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 1024.0f, 768.0f)];
+ self.webViewInvoice.delegate = self;
+ [self.webViewInvoice loadHTMLString:htmlStringForPDF baseURL:nil];
+
+}
+
+- (void) createPaymentPDF {
+
+ NSDate *today = [NSDate date];
+ NSCalendar *gregorian = [[NSCalendar alloc]
+ initWithCalendarIdentifier:NSGregorianCalendar];
+ NSDateComponents *weekdayComponents = [gregorian components:(NSDayCalendarUnit | NSWeekdayCalendarUnit | NSYearCalendarUnit | NSMonthCalendarUnit) fromDate:today];
+ NSInteger day = [weekdayComponents day];
+ NSInteger month = [weekdayComponents month];
+ NSInteger year = [weekdayComponents year];
+
+ NSString *date_today = [NSString stringWithFormat:@"%li-%li-%li",(long)month,(long)day,(long)year];
+
+ NSString *htmlStringForPDF = [NSString stringWithFormat:HTMLSTRING_PAYMENT];
+
+ self.payment_id = [NSString stringWithFormat:@"Payment_%@_%@_%@",self.user_id,self.user_id,[date_today stringByReplacingOccurrencesOfString:@"-" withString:@"_"]];
+
+ self.webViewPayment = [[UIWebView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 1024.0f, 768.0f)];
+ self.webViewPayment.delegate = self;
+ [self.webViewPayment loadHTMLString:htmlStringForPDF baseURL:nil];
+}
+
- (void)webViewDidStartLoad:(UIWebView *)webView {
//NSLog(@"start");
}
@@ -1350,57 +1338,98 @@ - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
}
- (void)webViewDidFinishLoad:(UIWebView *)theWebView {
- NSUInteger contentHeight = [[theWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.body.scrollHeight;"]] intValue];
- NSUInteger contentWidth = [[theWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.body.scrollWidth;"]] intValue];
- [theWebView setFrame:CGRectMake(0, 0, contentWidth, contentHeight)];
-// //NSLog(@"width:%i height:%i",contentWidth, contentHeight);
-
-// self.webViewHeight = [[self.webView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight;"] integerValue];
-
- CGRect screenRect = self.webView.frame;
-// double currentWebViewHeight = self.webViewHeight;
-// while (currentWebViewHeight > 0)
-// {
- self.imageName ++;
+ if (theWebView == self.webViewInvoice) {
+
+ NSUInteger contentHeight = [[theWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.body.scrollHeight;"]] intValue];
+ // NSUInteger contentWidth = [[theWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.body.scrollWidth;"]] intValue];
+ [theWebView setFrame:CGRectMake(0, 0, 1024, contentHeight)];
+ // //NSLog(@"width:%i height:%i",contentWidth, contentHeight);
+ // self.webViewHeight = [[self.webView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight;"] integerValue];
+
+ CGRect screenRect = self.webViewInvoice.frame;
UIGraphicsBeginImageContext(screenRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor blackColor] set];
CGContextFillRect(ctx, screenRect);
- [self.webView.layer renderInContext:ctx];
+ [self.webViewInvoice.layer renderInContext:ctx];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
- NSString *pngPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%d.png",self.imageName]];
+ NSString *pngPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png",self.invoice_number]];
-// if(currentWebViewHeight < 700)
-// {
- CGRect lastImageRect = CGRectMake(0, /*700 - currentWebViewHeight*/0, self.webView.frame.size.width, /*currentWebViewHeight*/768);
- CGImageRef imageRef = CGImageCreateWithImageInRect([newImage CGImage], lastImageRect);
-
- newImage = [UIImage imageWithCGImage:imageRef];
- CGImageRelease(imageRef);
-// }
+ CGRect lastImageRect = CGRectMake(0, 0, self.webViewInvoice.frame.size.width, self.webViewInvoice.frame.size.height);
+ CGImageRef imageRef = CGImageCreateWithImageInRect([newImage CGImage], lastImageRect);
+
+ newImage = [UIImage imageWithCGImage:imageRef];
+ CGImageRelease(imageRef);
[UIImagePNGRepresentation(newImage) writeToFile:pngPath atomically:YES];
-// [self.webView stringByEvaluatingJavaScriptFromString:@"window.scrollBy(0,960);"];
-// currentWebViewHeight -= 700;
-// }
- [self drawPdf];
+ CGSize pageSize = CGSizeMake(self.webViewInvoice.frame.size.width, self.webViewInvoice.frame.size.height);
+
+ if([self drawPdf:self.invoice_number pageSize:pageSize]) {
+ NSLog(@"Successfully created invoice");
+ [self createPaymentPDF];
+ }
+ }
+ else if (theWebView == self.webViewPayment) {
+
+ NSUInteger contentHeight = [[theWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.body.scrollHeight;"]] intValue];
+ // NSUInteger contentWidth = [[theWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.body.scrollWidth;"]] intValue];
+ [theWebView setFrame:CGRectMake(0, 0, 1024, contentHeight)];
+ // //NSLog(@"width:%i height:%i",contentWidth, contentHeight);
+
+ // self.webViewHeight = [[self.webView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight;"] integerValue];
+
+ CGRect screenRect = self.webViewPayment.frame;
+ UIGraphicsBeginImageContext(screenRect.size);
+ CGContextRef ctx = UIGraphicsGetCurrentContext();
+ [[UIColor blackColor] set];
+ CGContextFillRect(ctx, screenRect);
+
+ [self.webViewPayment.layer renderInContext:ctx];
+
+ UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
+ UIGraphicsEndImageContext();
+
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+ NSString *documentsDirectory = [paths objectAtIndex:0];
+ NSString *pngPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png",self.payment_id]];
+
+ CGRect lastImageRect = CGRectMake(0, 0, self.webViewPayment.frame.size.width, self.webViewPayment.frame.size.height);
+ CGImageRef imageRef = CGImageCreateWithImageInRect([newImage CGImage], lastImageRect);
+
+ newImage = [UIImage imageWithCGImage:imageRef];
+ CGImageRelease(imageRef);
+ [UIImagePNGRepresentation(newImage) writeToFile:pngPath atomically:YES];
+
+ CGSize pageSize = CGSizeMake(self.webViewPayment.frame.size.width, self.webViewPayment.frame.size.height);
+
+ if([self drawPdf:self.payment_id pageSize:pageSize]) {
+ NSLog(@"Successfully created Payment");
+ //if done
+ UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Transaction Successful" message:@"Your Transaction has completed Successfully!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
+ av.tag = 99;
+ [av show];
+
+ [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
+ [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
+ self.buttonSubmit.enabled = YES;
+ }
+ }
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
return YES;
}
-- (void) drawPdf
+- (BOOL) drawPdf:(NSString*)filename pageSize:(CGSize)pageSize
{
- CGSize pageSize = CGSizeMake(612, /*self.webViewHeight*/768);
- NSString *fileName = @"Demo.pdf";
+ NSString *fileName = [NSString stringWithFormat:@"%@.pdf",filename];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *pdfFileName = [documentsDirectory stringByAppendingPathComponent:fileName];
@@ -1410,17 +1439,22 @@ - (void) drawPdf
// Mark the beginning of a new page.
UIGraphicsBeginPDFPageWithInfo(CGRectMake(0, 0, pageSize.width, pageSize.height), nil);
- double currentHeight = 0.0;
- for (int index = 1; index <= self.imageName ; index++)
- {
- NSString *pngPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%d.png", index]];
+// double currentHeight = 0.0;
+ NSString *pngPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png", filename]];
UIImage *pngImage = [UIImage imageWithContentsOfFile:pngPath];
- [pngImage drawInRect:CGRectMake(0, currentHeight, pageSize.width, pngImage.size.height)];
- currentHeight += pngImage.size.height;
- }
+ [pngImage drawInRect:CGRectMake(0, /*currentHeight*/0, pageSize.width, pngImage.size.height)];
+// currentHeight += pngImage.size.height;
UIGraphicsEndPDFContext();
+
+
+ NSFileManager *fileManager = [NSFileManager defaultManager];
+
+ NSError *error;
+ BOOL success =[fileManager removeItemAtPath:pngPath error:&error];
+
+ return success;
}
@end
View
4 AgentBridge/ABridge_LoginViewController.m
@@ -106,13 +106,13 @@ - (void)viewDidLoad
self.textEmail.backgroundColor = [UIColor clearColor];
self.textPassword.backgroundColor = [UIColor clearColor];
- self.tableView.layer.borderColor = [UIColor colorWithRed:25.0f/255.0f green:25.0f/255.0f blue:25.0f/255.0f alpha:1.0f].CGColor;
+ self.tableView.layer.borderColor = [UIColor colorWithRed:75.0f/255.0f green:75.0f/255.0f blue:75.0f/255.0f alpha:1.0f].CGColor;
self.tableView.layer.borderWidth = 1.0f;
self.tableView.layer.cornerRadius = 4.0f;
self.tableView.layer.masksToBounds = YES;
// self.tableView.backgroundColor = [UIColor colorWithWhite:1.0f alpha:0.9f];
- self.tableView.separatorColor = [UIColor colorWithRed:25.0f/255.0f green:25.0f/255.0f blue:25.0f/255.0f alpha:1.0f];
+ self.tableView.separatorColor = [UIColor colorWithRed:75.0f/255.0f green:75.0f/255.0f blue:75.0f/255.0f alpha:1.0f];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
View
24 AgentBridge/ABridge_MenuViewController.m
@@ -105,23 +105,23 @@ - (void)viewWillAppear:(BOOL)animated {
NSManagedObjectContext *context = ((ABridge_AppDelegate *)[[UIApplication sharedApplication] delegate]).managedObjectContext;
- NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
- NSEntityDescription *entity = [NSEntityDescription entityForName:@"LoginDetails" inManagedObjectContext:context];
- [fetchRequest setEntity:entity];
- NSError *error = nil;
- NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
+// NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
+// NSEntityDescription *entity = [NSEntityDescription entityForName:@"LoginDetails" inManagedObjectContext:context];
+// [fetchRequest setEntity:entity];
+// NSError *error = nil;
+// NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
// LoginDetails *loginDetail = (LoginDetails*)[fetchedObjects firstObject];
- fetchRequest = [[NSFetchRequest alloc] init];
- entity = [NSEntityDescription entityForName:@"AgentProfile"
+ NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
+ NSEntityDescription *entity = [NSEntityDescription entityForName:@"AgentProfile"
inManagedObjectContext:context];
[fetchRequest setEntity:entity];
// NSPredicate *predicate = [NSPredicate predicateWithFormat:@"user_id=%@",loginDetail.user_id];
// [fetchRequest setPredicate:predicate];
- error = nil;
- fetchedObjects = nil;
- fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
+ NSError *error = nil;
+// fetchedObjects = nil;
+ NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
// AgentProfile *profileData = (AgentProfile*)[fetchedObjects firstObject];
@@ -142,6 +142,10 @@ - (void)viewWillAppear:(BOOL)animated {
imageView.contentMode = UIViewContentModeScaleAspectFill ;
imageView.image = [UIImage imageWithData:profileData.image_data];
+ if (imageView.image == nil) {
+ imageView.image = [UIImage imageNamed:@"blank-image"];
+ }
+
[self.buttonProfile addSubview:imageView];
self.buttonProfile.tag = YES;
View
12 AgentBridge/ABridge_PropertyPagesViewController.m
@@ -137,7 +137,7 @@ - (void)viewDidLoad
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -329,7 +329,7 @@ - (void)viewDidLoad
}];
[requestAccess setFailedBlock:^{
NSError *error = [requestAccess error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestAccess startAsynchronous];
@@ -415,7 +415,7 @@ - (void)viewDidLoad
}];
[requestNetwork setFailedBlock:^{
NSError *error = [requestNetwork error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[requestNetwork startAsynchronous];
@@ -759,7 +759,7 @@ - (void) loadPOPsImages {
// }];
// [request setFailedBlock:^{
// NSError *error = [request error];
-// //NSLog(@" error:%@",error);
+// NSLog(@" error:%@",error);
// }];
//
// [request startAsynchronous];
@@ -1227,7 +1227,7 @@ - (IBAction)buttonDescriptionPressed:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -1268,7 +1268,7 @@ - (IBAction)buttonDescriptionPressed:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
View
4 AgentBridge/ABridge_PropertyViewController.m
@@ -414,7 +414,7 @@ - (IBAction)savePopsToBuyer:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -456,7 +456,7 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
View
127 AgentBridge/ABridge_ReferralPagesViewController.m
@@ -136,10 +136,12 @@ - (void)viewDidLoad
self.loginDetail = (LoginDetails*)[fetchedObjects firstObject];
+ self.buttonChangeStatus.hidden = YES;
NSString *parameters = [NSString stringWithFormat:@"?user_id=%@&update_id=%@", self.loginDetail.user_id, self.referralDetails.referral_id];
NSString *urlString = [NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/check_if_signed.php%@", parameters];
+ __block BOOL restricted = NO;
__block NSString *client_name = self.referralDetails.client_name;
__block NSError *errorData = nil;
@@ -167,30 +169,33 @@ - (void)viewDidLoad
}
self.labelBuyerName.text = encryptBuyerName;
self.buttonVCard.hidden = YES;
+ restricted = YES;
}
else {
self.labelBuyerName.text = client_name;
self.buttonVCard.hidden = NO;
+ restricted = NO;
}
+ if ([self.referralDetails.agent_b integerValue] == [self.loginDetail.user_id integerValue] && [self.referralDetails.status integerValue] != REFERRAL_STATUS_CLOSED && !restricted) {
+ self.buttonChangeStatus.hidden = NO;
+ }
+ else if ([self.referralDetails.agent_a integerValue] == [self.loginDetail.user_id integerValue] && [self.referralDetails.status integerValue] == REFERRAL_STATUS_CLOSED && !restricted) {
+ self.buttonChangeStatus.hidden = NO;
+ }
+ else {
+ self.buttonChangeStatus.hidden = YES;
+ }
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
- if ([self.referralDetails.agent_b integerValue] == [self.loginDetail.user_id integerValue] && [self.referralDetails.status integerValue] != REFERRAL_STATUS_CLOSED) {
- self.buttonChangeStatus.hidden = NO;
- }
- else if ([self.referralDetails.agent_a integerValue] == [self.loginDetail.user_id integerValue] && [self.referralDetails.status integerValue] == REFERRAL_STATUS_CLOSED) {
- self.buttonChangeStatus.hidden = NO;
- }
- else {
- self.buttonChangeStatus.hidden = YES;
- }
+// self.buttonChangeStatus.hidden = NO; //tester
// self.labelBuyerName.text = self.referralDetails.client_name;
NSNumberFormatter * formatter = [[NSNumberFormatter alloc] init];
@@ -212,17 +217,20 @@ - (void)viewDidLoad
self.statusPicked_test = [self.referralDetails.status integerValue];
- if (self.referralDetails.image == nil || [self.referralDetails.image isEqualToString:@""]) {
- self.imagePicture.image = [UIImage imageNamed:@"blank-image"];
- }
- else {
if (self.referralDetails.image_data == nil) {
self.referralDetails.image_data = [NSData dataWithContentsOfURL:[NSURL URLWithString:self.referralDetails.image]];
}
self.imagePicture.image = [UIImage imageWithData:self.referralDetails.image_data];
-
+
+ if (self.referralDetails.image_data == nil) {
+ self.imagePicture.image = [UIImage imageNamed:@"blank-image"];
}
+
+
+
+
+
}
- (void)viewDidDisappear:(BOOL)animated {
@@ -276,31 +284,33 @@ - (UIImage*) imageForReferralStatus:(NSInteger)referral_status {
- (IBAction)changeStatus:(id)sender {
- switch (self.statusPicked_test) {
- case REFERRAL_STATUS_UNDERCONTRACT:
- self.arrayOfStatus = [NSArray arrayWithObjects: @"Active", @"Need Help", @"Closed", nil];
- break;
- case REFERRAL_STATUS_CLOSED:
- self.arrayOfStatus = [NSArray arrayWithObjects: @"Completed", nil];
- break;
- case REFERRAL_STATUS_NOGO:
- self.arrayOfStatus = [NSArray arrayWithObjects:nil];
- break;
- case REFERRAL_STATUS_NEEDHELP:
- self.arrayOfStatus = [NSArray arrayWithObjects:@"Active", @"Under Contract", @"No Go",nil];
- break;
- case REFERRAL_STATUS_PENDING:
- self.arrayOfStatus = [NSArray arrayWithObjects:@"Active", @"No Go", @"Need Help", nil];
- break;
- case REFERRAL_STATUS_ACCEPTED:
- self.arrayOfStatus = [NSArray arrayWithObjects: @"Under Contract", @"No Go", @"Need Help", nil];
- break;
- case REFERRAL_STATUS_COMMISSIONRECEIVED:
- self.arrayOfStatus = [NSArray arrayWithObjects:nil];
- break;
- default:
- break;
- }
+ self.arrayOfStatus = [NSArray arrayWithObjects: @"Active", @"Need Help", @"Closed", nil];
+
+// switch (self.statusPicked_test) {
+// case REFERRAL_STATUS_UNDERCONTRACT:
+// self.arrayOfStatus = [NSArray arrayWithObjects: @"Active", @"Need Help", @"Closed", nil];
+// break;
+// case REFERRAL_STATUS_CLOSED:
+// self.arrayOfStatus = [NSArray arrayWithObjects: @"Completed", nil];
+// break;
+// case REFERRAL_STATUS_NOGO:
+// self.arrayOfStatus = [NSArray arrayWithObjects:nil];
+// break;
+// case REFERRAL_STATUS_NEEDHELP:
+// self.arrayOfStatus = [NSArray arrayWithObjects:@"Active", @"Under Contract", @"No Go",nil];
+// break;
+// case REFERRAL_STATUS_PENDING:
+// self.arrayOfStatus = [NSArray arrayWithObjects:@"Active", @"No Go", @"Need Help", nil];
+// break;
+// case REFERRAL_STATUS_ACCEPTED:
+// self.arrayOfStatus = [NSArray arrayWithObjects: @"Under Contract", @"No Go", @"Need Help", nil];
+// break;
+// case REFERRAL_STATUS_COMMISSIONRECEIVED:
+// self.arrayOfStatus = [NSArray arrayWithObjects:nil];
+// break;
+// default:
+// break;
+// }
if ([self.arrayOfStatus count]) {
[self.pickerStatus reloadAllComponents];
@@ -365,7 +375,7 @@ - (IBAction)submitChange:(id)sender {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
@@ -382,7 +392,7 @@ - (IBAction)submitChange:(id)sender {
- (IBAction)cancelChange:(id)sender {
- [UIView animateWithDuration:0.6 animations:^{
+ [UIView animateWithDuration:0.2 animations:^{
CGRect frame = self.viewChangeStatus.frame;
frame.origin.y = 0.0f;
self.viewChangeStatus.frame = frame;
@@ -594,24 +604,24 @@ - (void) generateURLString:(NSInteger)row {
}
- (void)textViewDidBeginEditing:(UITextView *)textView {
-// [UIView animateWithDuration:0.2 animations:^{
-// CGRect frame = self.viewChangeStatus.frame;
-// frame.origin.y = -165.0f;
-// self.viewChangeStatus.frame = frame;
-// } completion:^(BOOL finished) {
-// }];
+ [UIView animateWithDuration:0.2 animations:^{
+ CGRect frame = self.viewChangeStatus.frame;
+ frame.origin.y = -165.0f;
+ self.viewChangeStatus.frame = frame;
+ } completion:^(BOOL finished) {
+ }];
}
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
if ([text isEqualToString:@"\n"]) {
-// [UIView animateWithDuration:1 animations:^{
-// [textView resignFirstResponder];
-// CGRect frame = self.viewChangeStatus.frame;
-// frame.origin.y = 0.0f;
-// self.viewChangeStatus.frame = frame;
-// } completion:^(BOOL finished) {
-//
-// }];
+ [UIView animateWithDuration:0.2 animations:^{
+ [textView resignFirstResponder];
+ CGRect frame = self.viewChangeStatus.frame;
+ frame.origin.y = 0.0f;
+ self.viewChangeStatus.frame = frame;
+ } completion:^(BOOL finished) {
+
+ }];
return NO;
}
return YES;
@@ -624,7 +634,7 @@ - (void)transactionCompletedSuccessfully {
NSString *status_type = [NSString stringWithFormat:@"%i",REFERRAL_STATUS_CLOSED];
- NSString *parameters = [NSString stringWithFormat:@"?user_id=%@&referral_id=%@&value_id=%@&agent_a=%@&status=%@&activity_type=%@note=%@", self.loginDetail.user_id, self.referralDetails.referral_id, self.referralDetails.referral_id,self.referralDetails.agent_a,status_type,@"19",@""];
+ NSString *parameters = [NSString stringWithFormat:@"?user_id=%@&referral_id=%@&value_id=%@&agent_a=%@&status=%@&activity_type=%@note=%@&buyer_id=%@", self.loginDetail.user_id, self.referralDetails.referral_id, self.referralDetails.referral_id,self.referralDetails.agent_a,status_type,@"19",@"",self.referralDetails.client_id];
self.urlStringStatusChange = [NSString stringWithFormat:@"http://keydiscoveryinc.com/agent_bridge/webservice/change_status.php%@", parameters];
@@ -642,6 +652,7 @@ - (void)transactionCompletedSuccessfully {
if([[json objectForKey:@"status"] integerValue] == 1){
self.statusPicked_test = self.statusPicked;
self.imagePendingAccepted.image = [self imageForReferralStatus:self.statusPicked_test];
+ self.buttonChangeStatus.hidden = YES;
}
[UIView animateWithDuration:0.2 animations:^{
@@ -655,7 +666,7 @@ - (void)transactionCompletedSuccessfully {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@"error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
View
24 AgentBridge/ABridge_ReferralPagesViewController.xib
@@ -146,16 +146,22 @@
<outlet property="delegate" destination="-1" id="OHc-ex-yDg"/>
</connections>
</pickerView>
- <textView clipsSubviews="YES" contentMode="scaleToFill" id="d0Z-74-Rzd">
- <rect key="frame" x="10" y="188" width="301" height="63"/>
+ <scrollView clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" delaysContentTouches="NO" canCancelContentTouches="NO" bouncesZoom="NO" id="243-Go-kRr">
+ <rect key="frame" x="10" y="188" width="301" height="128"/>
<autoresizingMask key="autoresizingMask" flexibleMaxY="YES"/>
- <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
- <fontDescription key="fontDescription" type="system" pointSize="14"/>
- <textInputTraits key="textInputTraits" autocapitalizationType="sentences" returnKeyType="done"/>
- <connections>
- <outlet property="delegate" destination="-1" id="6u4-Ig-pwh"/>
- </connections>
- </textView>
+ <subviews>
+ <textView clipsSubviews="YES" contentMode="scaleToFill" id="d0Z-74-Rzd">
+ <rect key="frame" x="0.0" y="0.0" width="301" height="63"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxY="YES"/>
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <textInputTraits key="textInputTraits" autocapitalizationType="sentences" returnKeyType="done"/>
+ <connections>
+ <outlet property="delegate" destination="-1" id="6u4-Ig-pwh"/>
+ </connections>
+ </textView>
+ </subviews>
+ </scrollView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Note" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="fMV-6d-7GZ">
<rect key="frame" x="10" y="170" width="42" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
View
3 AgentBridge/ABridge_ReferralViewController.m
@@ -82,6 +82,7 @@ - (void)viewDidLoad
self.loginDetail = (LoginDetails*)[fetchedObjects firstObject];
+
[self reloadPageController:@"In"];
}
@@ -245,7 +246,7 @@ -(void) reloadPageController:(NSString*)value {
}];
[request setFailedBlock:^{
NSError *error = [request error];
- //NSLog(@" error:%@",error);
+ NSLog(@" error:%@",error);
}];
[request startAsynchronous];
View
2