|
|
@@ -967,76 +967,84 @@ self.isrefreshing=false;
|
|
|
if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER) {
|
|
|
cell.btnaddPortfolio.hidden = YES;
|
|
|
|
|
|
-// cell.btnNotifyMe.hidden = YES;
|
|
|
-// CGRect wishListFrame = cell.btnaddWish.frame;
|
|
|
-// CGRect cartFrame = cell.btnaddCart.frame;
|
|
|
-// cartFrame.origin.x = wishListFrame.origin.x;
|
|
|
-// cell.btnaddCart.frame = cartFrame;
|
|
|
-
|
|
|
- __weak typeof(self) weakself = self;
|
|
|
- cell.notifyMeBlock = ^{
|
|
|
+ if (!notifyMe_switch) {
|
|
|
|
|
|
- NSString *emailAddr = [Singleton sharedInstance].customer_email;
|
|
|
+ cell.btnNotifyMe.hidden = YES;
|
|
|
+ CGRect wishListFrame = cell.btnaddWish.frame;
|
|
|
+ CGRect cartFrame = cell.btnaddCart.frame;
|
|
|
+ cartFrame.origin.x = wishListFrame.origin.x;
|
|
|
+ cell.btnaddCart.frame = cartFrame;
|
|
|
+
|
|
|
+ } else {
|
|
|
|
|
|
- if (!emailAddr.length) {
|
|
|
+ cell.btnNotifyMe.hidden = NO;
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
+ cell.notifyMeBlock = ^{
|
|
|
|
|
|
- [self showEmailAddrBox];
|
|
|
-
|
|
|
- } else {
|
|
|
+ NSString *emailAddr = [Singleton sharedInstance].customer_email;
|
|
|
|
|
|
- UIAlertView *waitting_alert = [RAUtils waiting_alert:@"Sending Email" title:@"Waitting"];
|
|
|
- dispatch_async(dispatch_get_global_queue(0,0), ^{
|
|
|
-
|
|
|
- NSDictionary *dic = [iSalesNetwork notifyModel:self.product_id emailAddr:nil];
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ if (!emailAddr.length) {
|
|
|
+
|
|
|
+ [self showEmailAddrBox];
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ UIAlertView *waitting_alert = [RAUtils waiting_alert:@"Sending Email" title:@"Waitting"];
|
|
|
+ dispatch_async(dispatch_get_global_queue(0,0), ^{
|
|
|
|
|
|
- [waitting_alert dismissWithClickedButtonIndex:0 animated:YES];
|
|
|
+ NSDictionary *dic = [iSalesNetwork notifyModel:self.product_id emailAddr:nil];
|
|
|
|
|
|
- if ([[dic valueForKey:@"result"] integerValue] != RESULT_TRUE) {
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
|
- NSString *msg = [NSString stringWithFormat:@"The email send to %@ failed",emailAddr];
|
|
|
- if ([[dic valueForKey:@"result"] integerValue] == 8) {
|
|
|
- if ([dic valueForKey:@"err_msg"]) {
|
|
|
- msg = [dic valueForKey:@"err_msg"];
|
|
|
- }
|
|
|
- }
|
|
|
+ [waitting_alert dismissWithClickedButtonIndex:0 animated:YES];
|
|
|
|
|
|
- UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
|
|
|
- UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+ if ([[dic valueForKey:@"result"] integerValue] != RESULT_TRUE) {
|
|
|
|
|
|
- }];
|
|
|
-
|
|
|
- [errorAlertVC addAction:action];
|
|
|
- [weakself presentViewController:errorAlertVC animated:YES completion:nil];
|
|
|
+ NSString *msg = [NSString stringWithFormat:@"The email send to %@ failed",emailAddr];
|
|
|
+ if ([[dic valueForKey:@"result"] integerValue] == 8) {
|
|
|
+ if ([dic valueForKey:@"err_msg"]) {
|
|
|
+ msg = [dic valueForKey:@"err_msg"];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ UIAlertController *errorAlertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
|
|
|
+ UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ [errorAlertVC addAction:action];
|
|
|
+ [weakself presentViewController:errorAlertVC animated:YES completion:nil];
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ [RAUtils message_alert:@"Notification is sent to default email" title:@"Message" controller:weakself];
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
- } else {
|
|
|
-
|
|
|
- [RAUtils message_alert:@"Notification is sent to default email" title:@"Message" controller:weakself];
|
|
|
-
|
|
|
- }
|
|
|
});
|
|
|
|
|
|
-
|
|
|
- });
|
|
|
+ }
|
|
|
|
|
|
+ };
|
|
|
+
|
|
|
+ cell.btnNotifyMe.layer.borderColor = [UIColor blackColor].CGColor;
|
|
|
+ cell.btnNotifyMe.layer.borderWidth = 1.0f;
|
|
|
+ cell.btnNotifyMe.layer.cornerRadius = 3.0f;
|
|
|
+ cell.btnNotifyMe.layer.masksToBounds = YES;
|
|
|
+ NSString *qtyStr = [section_json valueForKey:@"Availability"];
|
|
|
+ if (!qtyStr || !qtyStr.length || [qtyStr isEqualToString:@"In Production"] || [qtyStr isEqualToString:@"0"] || [qtyStr isEqualToString:@"Sold Out"]) {
|
|
|
+ cell.btnaddCart.enabled = NO;
|
|
|
+ cell.btnNotifyMe.alpha = 1.0;
|
|
|
+ cell.btnNotifyMe.enabled = YES;
|
|
|
+ } else {
|
|
|
+ cell.btnNotifyMe.enabled = NO;
|
|
|
+ cell.btnNotifyMe.alpha = 0.4;
|
|
|
+ cell.btnaddCart.enabled = YES;
|
|
|
}
|
|
|
+
|
|
|
|
|
|
- };
|
|
|
-
|
|
|
- cell.btnNotifyMe.layer.borderColor = [UIColor blackColor].CGColor;
|
|
|
- cell.btnNotifyMe.layer.borderWidth = 1.0f;
|
|
|
- cell.btnNotifyMe.layer.cornerRadius = 3.0f;
|
|
|
- cell.btnNotifyMe.layer.masksToBounds = YES;
|
|
|
- NSString *qtyStr = [section_json valueForKey:@"Availability"];
|
|
|
- if (!qtyStr || !qtyStr.length || [qtyStr isEqualToString:@"In Production"] || [qtyStr isEqualToString:@"0"] || [qtyStr isEqualToString:@"Sold Out"]) {
|
|
|
- cell.btnaddCart.enabled = NO;
|
|
|
- cell.btnNotifyMe.alpha = 1.0;
|
|
|
- cell.btnNotifyMe.enabled = YES;
|
|
|
- } else {
|
|
|
- cell.btnNotifyMe.enabled = NO;
|
|
|
- cell.btnNotifyMe.alpha = 0.4;
|
|
|
- cell.btnaddCart.enabled = YES;
|
|
|
}
|
|
|
|
|
|
} else {
|