|
|
@@ -968,6 +968,55 @@ self.isrefreshing=false;
|
|
|
cell.btnNotifyMe.layer.cornerRadius = 3.0f;
|
|
|
cell.btnNotifyMe.layer.masksToBounds = YES;
|
|
|
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
+ cell.notifyMeBlock = ^{
|
|
|
+
|
|
|
+ UIAlertView *waitting_alert = [RAUtils waiting_alert:@"Sending Email" title:@"Waiting"];
|
|
|
+ dispatch_async(dispatch_get_global_queue(0,0), ^{
|
|
|
+
|
|
|
+ NSDictionary *dic = [iSalesNetwork notifyModel:self.product_id emailAddr:nil];
|
|
|
+
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+
|
|
|
+ [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
|
|
|
+
|
|
|
+ NSInteger result = [[dic valueForKey:@"result"] integerValue];
|
|
|
+
|
|
|
+ if (result != RESULT_TRUE && result != RESULT_NO_EMAIL_ADDRESS) {
|
|
|
+
|
|
|
+ NSString *msg = [NSString stringWithFormat:@"The email send failed"];
|
|
|
+ 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 if (result == RESULT_TRUE){
|
|
|
+
|
|
|
+ [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
|
|
|
+
|
|
|
+ } else if (result == RESULT_NO_EMAIL_ADDRESS) {
|
|
|
+
|
|
|
+ [self showEmailAddrBox];
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
if (appDelegate.user_type == USER_ROLE_CUSTOMER) {
|
|
|
|
|
|
cell.btnaddPortfolio.hidden = YES;
|
|
|
@@ -980,53 +1029,7 @@ self.isrefreshing=false;
|
|
|
|
|
|
|
|
|
cell.btnNotifyMe.hidden = NO;
|
|
|
- __weak typeof(self) weakself = self;
|
|
|
- cell.notifyMeBlock = ^{
|
|
|
-
|
|
|
- UIAlertView *waitting_alert = [RAUtils waiting_alert:@"Sending Email" title:@"Waiting"];
|
|
|
- dispatch_async(dispatch_get_global_queue(0,0), ^{
|
|
|
-
|
|
|
- NSDictionary *dic = [iSalesNetwork notifyModel:self.product_id emailAddr:nil];
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
-
|
|
|
- [waitting_alert dismissWithClickedButtonIndex:0 animated:NO];
|
|
|
-
|
|
|
- NSInteger result = [[dic valueForKey:@"result"] integerValue];
|
|
|
-
|
|
|
- if (result != RESULT_TRUE && result != RESULT_NO_EMAIL_ADDRESS) {
|
|
|
-
|
|
|
- NSString *msg = [NSString stringWithFormat:@"The email send failed"];
|
|
|
- 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 if (result == RESULT_TRUE){
|
|
|
-
|
|
|
- [RAUtils message_alert:@"Notification is sent to default email address." title:@"Message" controller:weakself];
|
|
|
-
|
|
|
- } else if (result == RESULT_NO_EMAIL_ADDRESS) {
|
|
|
-
|
|
|
- [self showEmailAddrBox];
|
|
|
-
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- };
|
|
|
+
|
|
|
|
|
|
if (!appDelegate.order_code) { // 未打开订单状态
|
|
|
|
|
|
@@ -1081,6 +1084,7 @@ self.isrefreshing=false;
|
|
|
|
|
|
} else { // employee
|
|
|
|
|
|
+ // online
|
|
|
cell.btnaddPortfolio.hidden = NO;
|
|
|
cell.btnNotifyMe.hidden = NO;
|
|
|
|
|
|
@@ -1094,8 +1098,8 @@ self.isrefreshing=false;
|
|
|
cell.btnaddCart.enabled = YES;
|
|
|
}
|
|
|
|
|
|
+ // offline
|
|
|
if (appDelegate.offline_mode) {
|
|
|
-
|
|
|
cell.btnNotifyMe.hidden = YES;
|
|
|
}
|
|
|
|