alqindiirsyam há 2 anos atrás
pai
commit
d39fa6ce47

+ 11 - 10
appbuilder-ios/AppBuilder/AppBuilder/FirstTabViewController.swift

@@ -123,11 +123,11 @@ class FirstTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
     }
     
     override func viewDidAppear(_ animated: Bool) {
-        if (self.isUsingMyWebview() && self.webView.url != nil && !self.webView.url!.absoluteString.contains("nexilis/pages/tab1-main-only") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab3-main-only") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab1-main") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab3-commerce") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab1-video") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab3-main")) || FirstTabViewController.showModal {
-            ViewController.alwaysHideButton = true
-            self.hideTabBar()
-            ThirdTabViewController.atFirstPage = false
-        } else {
+//        if (self.isUsingMyWebview() && self.webView.url != nil && !self.webView.url!.absoluteString.contains("nexilis/pages/tab1-main-only") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab3-main-only") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab1-main") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab3-commerce") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab1-video") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab3-main")) || FirstTabViewController.showModal {
+//            ViewController.alwaysHideButton = true
+//            self.hideTabBar()
+//            ThirdTabViewController.atFirstPage = false
+//        } else {
             DispatchQueue.main.asyncAfter(deadline: .now() + 0.2, execute: {
                 var viewController = UIApplication.shared.windows.first!.rootViewController
                 if !(viewController is ViewController) {
@@ -153,7 +153,7 @@ class FirstTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
                     }
                 }
             })
-        }
+//        }
     }
     
     @objc func onShowAC(notification: NSNotification) {
@@ -538,11 +538,12 @@ extension FirstTabViewController: WKUIDelegate, WKNavigationDelegate {
                       ViewController.alwaysHideButton = false
                       showTabBar()
                       FirstTabViewController.atFirstPage = true
-                  } else if isUsingMyWebview() {
-                      ViewController.alwaysHideButton = true
-                      hideTabBar()
-                      FirstTabViewController.atFirstPage = false
                   }
+//                  else if isUsingMyWebview() {
+//                      ViewController.alwaysHideButton = true
+//                      hideTabBar()
+//                      FirstTabViewController.atFirstPage = false
+//                  }
               }
             }
             decisionHandler(.allow)

+ 11 - 10
appbuilder-ios/AppBuilder/AppBuilder/ThirdTabViewController.swift

@@ -131,11 +131,11 @@ class ThirdTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
     
     override func viewDidAppear(_ animated: Bool) {
         DispatchQueue.main.asyncAfter(deadline: .now() + 0.2, execute: {
-            if (self.isUsingMyWebview() && self.webView.url != nil && !self.webView.url!.absoluteString.contains("nexilis/pages/tab1-main-only") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab3-main-only") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab1-main") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab3-commerce") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab1-video") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab3-main")) || ThirdTabViewController.showModal {
-                ViewController.alwaysHideButton = true
-                self.hideTabBar()
-                ThirdTabViewController.atFirstPage = false
-            } else {
+//            if (self.isUsingMyWebview() && self.webView.url != nil && !self.webView.url!.absoluteString.contains("nexilis/pages/tab1-main-only") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab3-main-only") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab1-main") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab3-commerce") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab1-video") && !self.webView.url!.absoluteString.contains("nexilis/pages/tab3-main")) || ThirdTabViewController.showModal {
+//                ViewController.alwaysHideButton = true
+//                self.hideTabBar()
+//                ThirdTabViewController.atFirstPage = false
+//            } else {
                 var viewController = UIApplication.shared.windows.first!.rootViewController
                 if !(viewController is ViewController) {
                     viewController = self.parent
@@ -159,7 +159,7 @@ class ThirdTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
                         }
                     }
                 }
-            }
+//            }
         })
     }
     
@@ -549,11 +549,12 @@ extension ThirdTabViewController: WKUIDelegate {
                       ViewController.alwaysHideButton = false
                       showTabBar()
                       ThirdTabViewController.atFirstPage = true
-                  } else if isUsingMyWebview() {
-                      ViewController.alwaysHideButton = true
-                      hideTabBar()
-                      ThirdTabViewController.atFirstPage = false
                   }
+//                  else if isUsingMyWebview() {
+//                      ViewController.alwaysHideButton = true
+//                      hideTabBar()
+//                      ThirdTabViewController.atFirstPage = false
+//                  }
               }
             }
             decisionHandler(.allow)

+ 2 - 0
appbuilder-ios/NexilisLite/NexilisLite/Resource/id.lproj/Localizable.strings

@@ -312,3 +312,5 @@
 "Start Whiteboard/Screen Sharing" = "Mulai Whiteboard/Screen Sharing";
 "92:Username is empty" = "92:Nama pengguna kosong";
 "91:Invalid name or you must add Username to your contact first" = "91:Nama tidak valid atau Anda harus menambahkan Nama Pengguna ke kontak Anda terlebih dahulu";
+"108:Invalid Contact Center media parameter (0:Chat, 1:Audio Call, 2:Video Call)" = "108:Parameter media Pusat Panggilan tidak valid (0:Obrolan, 1:Panggilan Audio, 2:Panggilan Video)";
+"109:Invalid Contact Center category parameter" = "109:Parameter kategori Pusat Panggilan tidak valid";

+ 27 - 44
appbuilder-ios/NexilisLite/NexilisLite/Source/APIS.swift

@@ -47,20 +47,12 @@ public class APIS: NSObject {
         }
     }
     
-    public static func openContactCenter() {
+    public static func openContactCenter(media: Int? = nil, category: Int? = nil) {
         let isChangeProfile = Utils.getSetProfile()
         if !isChangeProfile {
             APIS.showChangeProfile()
             return
         }
-        let isWaitingRequestCC = UserDefaults.standard.bool(forKey: "waitingRequestCC")
-        if isWaitingRequestCC {
-            let imageView = UIImageView(image: UIImage(systemName: "info.circle"))
-            imageView.tintColor = .white
-            let banner = FloatingNotificationBanner(title: "You have requested Call Center, please wait for response.".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .info, colors: nil, iconPosition: .center)
-            banner.show()
-            return
-        }
         if User.isCallCenter(userType: (User.getData(pin: User.getMyPin())?.userType)!) {
             let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "myHistoryCC") as! HistoryCCViewController
             controller.isOfficer = true
@@ -73,43 +65,34 @@ public class APIS: NSObject {
                 UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
             }
         } else {
-            let controller = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorPersonalVC") as! EditorPersonal
-            controller.isContactCenter = true
-            let navigationController = UINavigationController(rootViewController: controller)
-            navigationController.defaultStyle()
-            if UIApplication.shared.visibleViewController?.navigationController != nil {
-                UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-            } else {
-                UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+            if media != nil {
+                if media! < 0 || media! > 2 {
+                    UIApplication.shared.visibleViewController?.view.makeToast("108:Invalid Contact Center media parameter (0:Chat, 1:Audio Call, 2:Video Call)".localized(), duration: 2)
+                    return
+                }
             }
-        }
-    }
-    
-    public static func callContactCenter(mode: String, speciality: String) {
-        let isChangeProfile = Utils.getSetProfile()
-        if !isChangeProfile {
-            APIS.showChangeProfile()
-            return
-        }
-        let isWaitingRequestCC = UserDefaults.standard.bool(forKey: "waitingRequestCC")
-        if isWaitingRequestCC {
-            let imageView = UIImageView(image: UIImage(systemName: "info.circle"))
-            imageView.tintColor = .white
-            let banner = FloatingNotificationBanner(title: "You have requested Call Center, please wait for response.".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .info, colors: nil, iconPosition: .center)
-            banner.show()
-            return
-        }
-        if User.isCallCenter(userType: (User.getData(pin: User.getMyPin())?.userType)!) {
-            let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "myHistoryCC") as! HistoryCCViewController
-            controller.isOfficer = true
-            let navigationController = UINavigationController(rootViewController: controller)
-            navigationController.defaultStyle()
-            if UIApplication.shared.visibleViewController?.navigationController != nil {
-                UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-            } else {
-                UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+            if category != nil {
+                if category != 0 {
+                    let service = CategoryCC.getDataFromServiceId(service_id: "\(category!)")
+                    if service == nil {
+                        UIApplication.shared.visibleViewController?.view.makeToast("109:Invalid Contact Center category parameter".localized(), duration: 2)
+                        return
+                    }
+                    let serviceChilds = CategoryCC.getDatafromParent(parent: service!.service_id)
+                    if serviceChilds.count > 0 {
+                        UIApplication.shared.visibleViewController?.view.makeToast("109:Invalid Contact Center category parameter".localized(), duration: 2)
+                        return
+                    }
+                }
+            }
+            let isWaitingRequestCC = UserDefaults.standard.bool(forKey: "waitingRequestCC")
+            if isWaitingRequestCC {
+                let imageView = UIImageView(image: UIImage(systemName: "info.circle"))
+                imageView.tintColor = .white
+                let banner = FloatingNotificationBanner(title: "You have requested Call Center, please wait for response.".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .info, colors: nil, iconPosition: .center)
+                banner.show()
+                return
             }
-        } else {
             let controller = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorPersonalVC") as! EditorPersonal
             controller.isContactCenter = true
             let navigationController = UINavigationController(rootViewController: controller)

+ 4 - 1
appbuilder-ios/NexilisLite/NexilisLite/Source/CoreMessage_TMessageBank.swift

@@ -1690,7 +1690,7 @@ public class CoreMessage_TMessageBank {
         return tmessage
     }
     
-    public static func getRequestCallCenter(p_channel:Int) -> TMessage {
+    public static func getRequestCallCenter(p_channel:Int, category_id: String = "") -> TMessage {
         let me = UserDefaults.standard.string(forKey: "me")!
         let tmessage = TMessage()
         tmessage.mCode = CoreMessage_TMessageCode.REQUEST_CALL_CENTER
@@ -1698,6 +1698,9 @@ public class CoreMessage_TMessageBank {
         tmessage.mPIN = me
         tmessage.mBodies[CoreMessage_TMessageKey.CHANNEL] = "\(p_channel)"
         tmessage.mBodies[CoreMessage_TMessageKey.BUSINESS_ENTITY] = ""
+        if !category_id.isEmpty{
+            tmessage.mBodies[CoreMessage_TMessageKey.CATEGORY_ID] = category_id
+        }
         return tmessage
     }
     

+ 30 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/IncomingThread.swift

@@ -163,6 +163,8 @@ class IncomingThread {
             incomingWBSS(message: message)
         } else if message.getCode() == CoreMessage_TMessageCode.INCOMING_CALL_CC {
             incomingCallCC(message: message)
+        } else if message.getCode() == CoreMessage_TMessageCode.GET_WORKING_AREA_CONTACT_CENTER {
+            saveWorkingArea(message: message)
         } else {
             print("unprocessed code", message.getCode())
             ack(message: message)
@@ -175,6 +177,34 @@ class IncomingThread {
     /**
      *
      */
+    private func saveWorkingArea(message: TMessage) -> Void {
+        let data = message.getBody(key: CoreMessage_TMessageKey.DATA)
+        if !data.isEmpty {
+            if let jsonArray = try! JSONSerialization.jsonObject(with: data.data(using: String.Encoding.utf8)!, options: JSONSerialization.ReadingOptions()) as? [AnyObject] {
+                Database.shared.database?.inTransaction({ (fmdb, rollback) in
+                    do {
+                        for json in jsonArray {
+                            var parent = CoreMessage_TMessageUtil.getString(json: json, key: CoreMessage_TMessageKey.PARENT_ID)
+                            if parent.isEmpty {
+                                parent = "-99"
+                            }
+                            _ = try Database.shared.insertRecord(fmdb: fmdb, table: "WORKING_AREA", cvalues: [
+                                "area_id" : CoreMessage_TMessageUtil.getString(json: json, key: CoreMessage_TMessageKey.WORKING_AREA),
+                                "name" : CoreMessage_TMessageUtil.getString(json: json, key: CoreMessage_TMessageKey.NAME),
+                                "parent" : CoreMessage_TMessageUtil.getString(json: json, key: CoreMessage_TMessageKey.PARENT_ID),
+                                "level" : CoreMessage_TMessageUtil.getString(json: json, key: CoreMessage_TMessageKey.LEVEL)
+                            ], replace: true)
+                        }
+                        ack(message: message)
+                    } catch {
+                        rollback.pointee = true
+                        print(error)
+                    }
+                })
+            }
+        }
+    }
+    
     private func incomingCallCC(message: TMessage) {
         if let packetId = message.mBodies[CoreMessage_TMessageKey.PACKET_ID] {
             _ = Nexilis.responseString(packetId: packetId, message: "01")

+ 20 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/Nexilis.swift

@@ -160,6 +160,16 @@ public class Nexilis: NSObject {
                 getServiceBank()
                 getPullWorkingArea()
                 delegate.onSuccess(userId: me)
+                if let response = Nexilis.writeSync(message: getPrefs(key: "default_cc"), timeout: 5000) {
+                    if response.mBodies[CoreMessage_TMessageKey.ERRCOD] == "00" {
+                        let data = response.getBody(key: CoreMessage_TMessageKey.DATA)
+                        if let json = try! JSONSerialization.jsonObject(with: data.data(using: String.Encoding.utf8)!, options: []) as? [[String: Any?]] {
+                            if json.count > 0 , let default_cc = json[0]["default_cc"] as? String {
+                                Utils.setDefaultCC(value: default_cc)
+                            }
+                        }
+                    }
+                }
                 if showButton {
                     DispatchQueue.main.async {
                         var viewController = UIApplication.shared.windows.first?.rootViewController
@@ -195,6 +205,16 @@ public class Nexilis: NSObject {
         }
     }
     
+    private static func getPrefs(key: String) -> TMessage {
+        let tMessage = NexilisLite.TMessage()
+        let me = UserDefaults.standard.string(forKey: "me")
+        tMessage.mCode = "PPR"
+        tMessage.mStatus = CoreMessage_TMessageUtil.getTID()
+        tMessage.mBodies[CoreMessage_TMessageKey.F_PIN] = me
+        tMessage.mBodies[CoreMessage_TMessageKey.KEY] = key
+        return tMessage
+    }
+    
     private static func getServiceBank() {
         DispatchQueue.global().asyncAfter(deadline: .now(), execute: {
             _ = Nexilis.write(message: CoreMessage_TMessageBank.getServiceBank())

+ 8 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/Utils.swift

@@ -136,6 +136,14 @@ public final class Utils {
         return Utils.getURLBase()! + "dashboardv2/uploads/fb_icon/" + Utils.getIconDock()!
     }
     
+    static func setDefaultCC(value: String){
+        UserDefaults.standard.set(value, forKey: "default_cc")
+    }
+    
+    static func getDefaultCC() -> String? {
+        return UserDefaults.standard.string(forKey: "default_cc")
+    }
+    
     public static var inTabChats = false
 }
 public extension UIImage {

+ 1 - 1
appbuilder-ios/NexilisLite/NexilisLite/Source/View/BNIView/WorkingAreaPicker.swift

@@ -18,7 +18,7 @@ class WorkingAreaPicker: UIViewController, UISearchBarDelegate, UITableViewDeleg
     override func viewDidLoad() {
         super.viewDidLoad()
 
-        self.view.backgroundColor = .black.withAlphaComponent(0.3)
+//        self.view.backgroundColor = .black.withAlphaComponent(0.3)
         
         let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
         tapGesture.cancelsTouchesInView = false

+ 40 - 27
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorPersonal.swift

@@ -994,11 +994,18 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
                 row["chat_date"] = "Today".localized()
                 let listStringName: [String] = ["Chat with a Representative".localized(), "Video Call a Representative".localized(), "Call a Representative".localized()]
                 var data : [CategoryCC] = []
-                for i in 0..<listStringName.count {
-                    data.append(CategoryCC(id: "level0_\(i)", service_id: "", service_name: listStringName[i], parent: "\(i)", description: "", is_tablet: "0"))
+                if Utils.getDefaultCC() == "No" {
+                    let category = CategoryCC.getDatafromParent(parent: "-99")
+                    for i in 0..<category.count {
+                        data.append(CategoryCC(id: "level0_\(i)", service_id: category[i].service_id, service_name: category[i].service_name, parent: category[i].parent, description: category[i].description, is_tablet: "0"))
+                    }
+                } else {
+                    for i in 0..<listStringName.count {
+                        data.append(CategoryCC(id: "level0_\(i)", service_id: "", service_name: listStringName[i], parent: "\(i)", description: "", is_tablet: "0"))
+                    }
+                    row["attachment_flag"] = "503"
                 }
                 row["category_cc"] = data
-                row["attachment_flag"] = "503"
                 dataDates.append("Today".localized())
                 dataMessages.append(row)
             }
@@ -2355,6 +2362,10 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
         var channel = 0
         var row: [String: Any?] = [:]
         if nowSelectedCategoryCC.isEmpty || level > levelNow {
+            if Utils.getDefaultCC() == "No" && !showToastTwiceClick {
+                self.showToast(message: "You can press your choice again to change category".localized(), font: UIFont.systemFont(ofSize: 12, weight: .medium), controller: self)
+                showToastTwiceClick = true
+            }
             row["message_id"] = ""
             row["chat_date"] = "Today".localized()
             let dataChat: [CategoryCC] = CategoryCC.getDatafromParent(parent: service_id!)
@@ -2447,30 +2458,32 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
                 return
             }
         }
-//        if sender.backgroundColor != .orangeBNI {
-//            var button = dataMessages[dataMessages.count - 2]["category_cc"] as! [CategoryCC]
-//            if dataMessages[Int(level)!]["attachment_flag"] != nil && dataMessages[Int(level)!]["attachment_flag"] as! String == "503" {
-//                button = dataMessages[dataMessages.count - 1]["category_cc"] as! [CategoryCC]
-//            }
-//            for i in button {
-//                if i.id == id! {
-//                    i.isActive = true
-//                    break
-//                }
-//            }
-//            sender.backgroundColor = .orangeBNI
-//            dataMessages[dataMessages.count - 2]["category_cc"] = button
-//        } else {
-//            let button = dataMessages[dataMessages.count - 1]["category_cc"] as! [CategoryCC]
-//            for i in button {
-//                if i.id == id! {
-//                    i.isActive = false
-//                    break
-//                }
-//            }
-//            sender.backgroundColor = .clear
-//            dataMessages[dataMessages.count - 1]["category_cc"] = button
-//        }
+        if Utils.getDefaultCC() == "No" {
+            if sender.backgroundColor != .orangeBNI {
+                var button = dataMessages[dataMessages.count - 2]["category_cc"] as! [CategoryCC]
+                if dataMessages[Int(level)!]["attachment_flag"] != nil && dataMessages[Int(level)!]["attachment_flag"] as! String == "503" {
+                    button = dataMessages[dataMessages.count - 1]["category_cc"] as! [CategoryCC]
+                }
+                for i in button {
+                    if i.id == id! {
+                        i.isActive = true
+                        break
+                    }
+                }
+                sender.backgroundColor = .orangeBNI
+                dataMessages[dataMessages.count - 2]["category_cc"] = button
+            } else {
+                let button = dataMessages[dataMessages.count - 1]["category_cc"] as! [CategoryCC]
+                for i in button {
+                    if i.id == id! {
+                        i.isActive = false
+                        break
+                    }
+                }
+                sender.backgroundColor = .clear
+                dataMessages[dataMessages.count - 1]["category_cc"] = button
+            }
+        }
         if isRequest {
             requestContactCenter(channel: channel, service_id: service_id!, row: row)
         } else {

+ 16 - 6
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/SetInternalCSAccount.swift

@@ -57,7 +57,7 @@ public class SetInternalCSAccount: UITableViewController {
     }
     
     public override func viewDidAppear(_ animated: Bool) {
-        self.navigationController?.navigationBar.topItem?.title = "Backup & Restore".localized()
+        self.navigationController?.navigationBar.topItem?.title = isSetCS ? "Set CS Account".localized()  :"Set Internal Account".localized()
         self.navigationController?.navigationBar.setNeedsLayout()
         self.title = isSetCS ? "Set CS Account".localized()  :"Set Internal Account".localized()
     }
@@ -66,9 +66,9 @@ public class SetInternalCSAccount: UITableViewController {
         DispatchQueue.global().async {
             Database.shared.database?.inTransaction({ (fmdb, rollback) in
                 var r: [User] = []
-                var query =  "SELECT u.f_pin, u.first_name, u.last_name, u.image_id, u.user_type FROM BUDDY u where u.f_pin <> '\(User.getMyPin()!)' and u.user_type <> '24' and u.official_account <> '1' and u.official_account <> '2' and u.official_account <> '3' UNION SELECT m.f_pin, m.first_name, m.last_name, m.thumb_id, '23' as user_type FROM GROUPZ_MEMBER m where group_id = (select g.group_id from GROUPZ g where g.official = 1 and g.level = 2) and m.position <> '1' order by 2 collate nocase asc"
+                var query =  "SELECT u.f_pin, u.first_name, u.last_name, u.image_id, u.user_type FROM BUDDY u where u.f_pin <> '\(User.getMyPin()!)' and u.user_type <> '24' and u.official_account <> '1' and u.official_account <> '2' and u.official_account <> '3' and u.user_type <> '23' order by 2 collate nocase asc"
                 if self.isSetCS {
-                    query =  "SELECT u.f_pin, u.first_name, u.last_name, u.image_id, u.user_type FROM BUDDY u where u.f_pin <> '\(User.getMyPin()!)' and u.official_account <> '1' and u.official_account <> '2' and u.official_account <> '3' UNION SELECT m.f_pin, m.first_name, m.last_name, m.thumb_id, '24' as user_type FROM GROUPZ_MEMBER m where group_id = (select g.group_id from GROUPZ g where g.official = 1 and g.level = 3) and m.position <> '1' order by 2 collate nocase asc"
+                    query =  "SELECT u.f_pin, u.first_name, u.last_name, u.image_id, u.user_type FROM BUDDY u LEFT JOIN GROUPZ_MEMBER m ON u.f_pin = m.f_pin where u.f_pin <> '\(User.getMyPin()!)' and u.official_account <> '1' and u.official_account <> '2' and u.official_account <> '3' and (u.user_type = '23' or u.user_type = '24') and group_id = (select g.group_id from GROUPZ g where g.official = 1 and g.level = 3) and m.position <> '1' order by 2 collate nocase asc"
                 }
                 if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: query) {
                     while cursorData.next() {
@@ -80,8 +80,9 @@ public class SetInternalCSAccount: UITableViewController {
                         if (user.firstName + " " + user.lastName).trimmingCharacters(in: .whitespaces) == "USR\(user.pin)" {
                             continue
                         }
-                        print("WEW <> \(cursorData.string(forColumnIndex: 1)!) <> \(cursorData.string(forColumnIndex: 4)!)")
-                        r.append(user)
+                        if r.first(where: {$0.pin == user.pin}) == nil {
+                            r.append(user)
+                        }
                     }
                     cursorData.close()
                 }
@@ -242,7 +243,16 @@ public class SetInternalCSAccount: UITableViewController {
         if User.isCallCenter(userType: user.userType!) || (User.isInternal(userType: user.userType!) && !isSetCS) {
             unsetInternalCS(user: user)
         } else {
-            setInternalCS(user: user)
+            if Utils.getDefaultCC() == "No" {
+                let viewSetOfficer = SetOfficerBNI()
+                viewSetOfficer.f_pin = user.pin
+                viewSetOfficer.name = user.fullName
+                viewSetOfficer.modalTransitionStyle = .crossDissolve
+                viewSetOfficer.modalPresentationStyle = .custom
+                self.present(viewSetOfficer, animated: true)
+            } else {
+                setInternalCS(user: user)
+            }
         }
     }
 }

+ 2 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/SetOfficerBNI.swift

@@ -212,6 +212,8 @@ class SetOfficerBNI: UIViewController {
             if chosenSecondLayer == "Yes".localized() {
                 paddingTopFinishButton.constant = paddingTopFinishButton.constant + 45
             }
+        } else {
+            paddingTopFinishButton.constant = 105
         }
     }
     

+ 2 - 2
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/SignUpSignIn.swift

@@ -285,7 +285,7 @@ public class SignUpSignIn: UIViewController {
                             UserDefaults.standard.synchronize()
                             // pos registration
                             _ = Nexilis.write(message: CoreMessage_TMessageBank.getPostRegistration(p_pin: id))
-                            DispatchQueue.main.async {
+                            DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: {
                                 Nexilis.hideLoader(completion: {
                                     let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
                                     imageView.tintColor = .white
@@ -306,7 +306,7 @@ public class SignUpSignIn: UIViewController {
                                     }
                                     self.isDismiss?(thumb)
                                 })
-                            }
+                            })
                         }
                     } else {
                         Database.shared.database?.inTransaction({ (fmdb, rollback) in