From e6068da47c1bef5517c9e5fdc8c726766867ad4e Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 15:10:02 +0800
Subject: [PATCH] Merge branch 'master' into LEXUpgrade2023-Deloitte

---
 force-app/main/default/pages/SearchVisitor.page |  125 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 109 insertions(+), 16 deletions(-)

diff --git a/force-app/main/default/pages/SearchVisitor.page b/force-app/main/default/pages/SearchVisitor.page
index 533f902..e8ddbf8 100644
--- a/force-app/main/default/pages/SearchVisitor.page
+++ b/force-app/main/default/pages/SearchVisitor.page
@@ -4,10 +4,18 @@
     <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
     <!-- 20220217 Li Jun for PIPL start -->
     <apex:includeScript value="{!URLFOR($Resource.AWSService, 'AWSService.js') }" />
-    <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
+    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
     <!-- 20220217 Li Jun for PIPL End -->
     <script type="text/javascript">
         AWSService.sfSessionId = '{!GETSESSIONID()}';
+        //zhj 鏂版柟妗堟敼閫� 2022-12-06 start
+        var accountName = '';
+        var dataIdManageCodeMap = {};
+        //zhj 鏂版柟妗堟敼閫� 2022-12-06 end
+        //鍍忓尰鐢熷尯鍒�(鑱屽姟)涓嬫媺鍒楄〃鍔犲叆****
+        // var o = new Option();
+        // o.text = '****';
+        // document.getElementById('Page:mainForm:idSearchVisitor:updateContactDoctorDivision').add(o);
         function addContact(){
             window.opener.showModal();
             
@@ -188,11 +196,29 @@
                 let y=window.event.y; 
                 createDiv.style.left=x;  
                 createDiv.style.top=y;  
+                createDiv.style.marginLeft='20px';
+                createDiv.style.marginTop='-40px';
+                createDiv.style.height='80px';  
+                createDiv.style.width='120px';
                 createDiv.style.background = "#dddddd";
                 createDiv.style.position = "absolute";
                 parentNode.appendChild(createDiv);  
                 parentNode.style.position = "relative";
             }            
+        }
+
+
+        function showPITR(obj){
+            var awsDataId = obj.childNodes[1].childNodes[2].value;
+            if(awsDataId.length == 1){
+                let sfId = j$(escapeVfId('Page:mainForm:idSearchVisitor:idAddVisitor:' + awsDataId + ':idAddHiddenId')).val()
+                awsDataId = sfIdToAWSIdMapValue.get(sfId);聽
+            }
+            if(contactInfo[awsDataId]){
+                document.getElementById(obj.childNodes[1].childNodes[0].id).innerText = contactInfo[awsDataId].lastName;
+                document.getElementById(obj.childNodes[3].childNodes[0].id).innerText = contactInfo[awsDataId].doctorDivision1;
+                document.getElementById(obj.childNodes[4].childNodes[0].id).innerText = contactInfo[awsDataId].phone;
+            }
         }
 
         function hidePIDiv(obj){
@@ -236,16 +262,16 @@
                 document.getElementById('Page:mainForm:AWS_Data_Id__c').value = obj.dataId;
                 
                 document.getElementById("Page:mainForm:idSearchVisitor:updateContactLastName").value = obj.lastName;
-                document.getElementById("Page:mainForm:LastName_Encrypted__c").value = obj.lastNameEncrypt;
+                //document.getElementById("Page:mainForm:LastName_Encrypted__c").value = obj.lastNameEncrypt;   //zhj 鏂版柟妗堟敼閫� 2022-12-05
 
-                document.getElementById("Page:mainForm:idSearchVisitor:updateContactPhone").value = obj.phone;
-                document.getElementById("Page:mainForm:Phone_Encrypted__c").value = obj.phoneEncrypt;
+                document.getElementById("Page:mainForm:idSearchVisitor:updateContactPhone").value = obj.phone; 
+                //document.getElementById("Page:mainForm:Phone_Encrypted__c").value = obj.phoneEncrypt; //zhj 鏂版柟妗堟敼閫� 2022-12-05
 
                 document.getElementById("Page:mainForm:idSearchVisitor:updateContactType").value = obj.type;
-                document.getElementById("Page:mainForm:Type_Encrypted__c").value = obj.typeEncrypt;
+                //document.getElementById("Page:mainForm:Type_Encrypted__c").value = obj.typeEncrypt;   //zhj 鏂版柟妗堟敼閫� 2022-12-05
 
                 document.getElementById("Page:mainForm:idSearchVisitor:updateContactDoctorDivision").value = obj.doctorDivision1;
-                document.getElementById("Page:mainForm:Doctor_Division1_Encrypted__c").value = obj.doctorDivision1Encrypt;
+                //document.getElementById("Page:mainForm:Doctor_Division1_Encrypted__c").value = obj.doctorDivision1Encrypt;    //zhj 鏂版柟妗堟敼閫� 2022-12-05
             }
             
         }
@@ -255,20 +281,66 @@
             let moduleName = AWSService.insertModule;
             if (selectedAwsDataId) {
                 moduleName = AWSService.updateModule;
-            	url = staticResources.updateUrl
+                url = staticResources.updateUrl
             }
             console.log('Payload for AWS:'+payloadForNewPI + ' Module Name:'+moduleName);
-            AWSService.postAWS(url,moduleName, payloadForNewPI, function(result){
+            //zhj 鏂版柟妗堟敼閫� 2022-12-06 鍒ゆ柇鏇存柊鎴栧垱寤虹殑contact鏄惁閲嶅 start 
+            // var accountId = '{!vp}';
+            // debugger
+            // Visualforce.remoting.Manager.invokeAction(
+            //     'SearchVisitorController.searchContactByAccountId', 
+            //     accountId,
+            //     function (result, event) {
+            //         if(result.status == 'fail'){
+            //             //alert(result.message);
+            //             document.getElementById("errorMsg").innerHTML = result.message;
+            //             unblockUI();
+            //             return
+            //         }
+            //         accountName = result.accountName;
+            //         dataIdManageCodeMap = result.dataIdManageCodeMap;
+            //         var contactList = '';
+            //         for(var i = 0; i<result.contactList.length; i++){
+            //             if(result.contactList[i].AWS_Data_Id__c)
+            //                 contactList += ',' + result.contactList[i].AWS_Data_Id__c;
+            //         }
+            //         contactList = contactList.substring(1);
+            //         payloadForNewPI = JSON.parse(payloadForNewPI);
+            //         payloadForNewPI[0].contactIds = contactList;
+            //         payloadForNewPI = JSON.stringify(payloadForNewPI);
+            //         AWSService.postAWS(url+'V2',moduleName, payloadForNewPI, function(result){
+            //             aws_result = result;
+            //             if(result.status == '129'){
+            //                 unblockUI();
+            //                 alert('瀹㈡埛 [ '+accountName+ ' ],宸插瓨鍦ㄧ浉鍚屽悕瀛楃殑鑱旂郴浜� 浜哄憳绠$悊缂栫爜 ['+dataIdManageCodeMap[result.object[0].dataId]+' ] 锛屼笉鑳介噸澶嶅垱寤猴紝璇蜂簡瑙�');
+            //                 return
+            //             }
+            //             SetEditObj();
+            //             saveNew();
+            //         }, staticResources.token);
+            //     },
+            //     { escape: true }
+            // );
+            payloadForNewPI = JSON.parse(payloadForNewPI);
+            payloadForNewPI[0].contactIds = '';
+            payloadForNewPI[0].isMobileVerif = false;
+            payloadForNewPI[0].isNameMobileVerif = false;
+            payloadForNewPI = JSON.stringify(payloadForNewPI);
+             AWSService.postAWS(url+'V2',moduleName, payloadForNewPI, function(result){
                 aws_result = result;
                 SetEditObj();
                 saveNew();
-            }, staticResources.token);
+             }, staticResources.token);
+
+            //zhj 鏂版柟妗堟敼閫� 2022-12-06 end
         }
 
         function GetEditObj(){
             return JSON.stringify([{
                 lastName : document.getElementById("Page:mainForm:idSearchVisitor:updateContactLastName").value,
                 phone : document.getElementById("Page:mainForm:idSearchVisitor:updateContactPhone").value,
+                type : document.getElementById("Page:mainForm:idSearchVisitor:updateContactType").value,
+                doctorDivision1 : document.getElementById("Page:mainForm:idSearchVisitor:updateContactDoctorDivision").value == '_\x01_'?'':document.getElementById("Page:mainForm:idSearchVisitor:updateContactDoctorDivision").value,
                 dataId:selectedAwsDataId
             }]);
         }
@@ -280,12 +352,26 @@
                 return;
             }
             blockme();
+            let es = document.getElementsByTagName('select')
+            for(let ei in es){
+                let e = es[ei];
+                for(let opi in e.options){
+                    let op = e.options[opi];
+                    if(!op)continue;
+                    if(op.value == "*****" && op.selected){
+                        unblockUI();
+                        alert('涓嬫媺妗嗕笉鑳戒富鍔ㄩ�夋嫨瀵嗘枃閫夐」')
+                        return;
+                    }
+                }
+            }
             ProcessPIForAWS({},GetEditObj());
         }
         function Trans(){
+            console.log('SFRcordId:'+document.getElementById('Page:mainForm:sfContactId').value);
             AWSService.postAWS(staticResources.transactionUrl,AWSService.confirmTrans, JSON.stringify({
                     "txId":aws_result.txId,
-                    "sfRecordId":"",
+                    "sfRecordId":document.getElementById('Page:mainForm:sfContactId').value,
                     "isSuccess":1
             }), function(result){
                 window.location.reload();
@@ -327,16 +413,19 @@
         <apex:actionFunction name="editVistor" action="{!editVistor}" rerender="idRegistration" oncomplete="assignDencrypted();setButtonDisable(document.getElementById('Page:mainForm:idSearchVisitor:idRegSave'), false);">
             <apex:param name="index" assignTo="{!index}" value=""/>
         </apex:actionFunction>
-        <apex:actionFunction name="saveNew" action="{!regContact}" rerender="idRegistration,idRezultVisitor,idAddVisitor,idMessage" onComplete="Trans();">
+        <apex:actionFunction name="saveNew" action="{!regContact}" rerender="idRegistration,idRezultVisitor,idAddVisitor,idMessage,sfContactId" onComplete="Trans()">
         </apex:actionFunction>
          <!-- Add By Li Jun for PIPL 20220228 Start -->
-         <apex:inputHidden id="LastName_Encrypted__c" value="{!rc.LastName_Encrypted__c}"/>
+         <!-- zhj 鏂版柟妗堟敼閫� 2022-12-19 start -->
+         <!-- <apex:inputHidden id="LastName_Encrypted__c" value="{!rc.LastName_Encrypted__c}"/>
          <apex:inputHidden id="Phone_Encrypted__c" value="{!rc.Phone_Encrypted__c}"/>
 
          <apex:inputHidden id="Type_Encrypted__c" value="{!rc.Type_Encrypted__c}"/>
-         <apex:inputHidden id="Doctor_Division1_Encrypted__c" value="{!rc.Doctor_Division1_Encrypted__c}"/>
+         <apex:inputHidden id="Doctor_Division1_Encrypted__c" value="{!rc.Doctor_Division1_Encrypted__c}"/> -->
+         <!-- zhj 鏂版柟妗堟敼閫� 2022-12-19 end -->
 
          <apex:inputHidden id="AWS_Data_Id__c" value="{!rc.AWS_Data_Id__c}"/>
+         <apex:inputHidden id="sfContactId" value="{!sfContactId}"/>
          <!-- Add By Li Jun for PIPL 20220221 End -->
             <apex:pageBlock id="idSearchVisitor" >
                 <table width="1060" height="50" border="0">
@@ -412,7 +501,7 @@
                     <tr>
                         <td>
                         <div id="iframelike">
-                        <apex:pageBlockTable id="idRezultVisitor" value="{!scwl}" var="scw" border="1" columns="8" columnsWidth="47px,90px,,90px,180x,90px,40px,200px">
+                        <apex:pageBlockTable id="idRezultVisitor" value="{!scwl}" var="scw" onRowMouseOver="showPITR(this)" border="1" columns="8" columnsWidth="47px,90px,,90px,180x,90px,40px,200px">
                             <apex:column >
                                 <apex:facet name="header">{!$Label.Selected}</apex:facet>
                                 <input type="button" id="idSlt" value="{!$Label.Selected}" onclick="sltContact('{!scw.index}');"  class="btn" style="width:40px"/>
@@ -421,6 +510,7 @@
                                 <apex:facet name="header">{!$Label.Visitor_Name}</apex:facet>
                                 <apex:outputLink onmouseover="showPIDiv('{!scw.con.AWS_Data_Id__c}',this)"  onmouseout="hidePIDiv(this)" value="/{!scw.con.Id}" id="idName" target="_blank">{!scw.con.Name}</apex:outputLink>
                                 <apex:inputText id="idHiddenId" value="{!scw.conid}" style="display:none" />
+                                <apex:inputText id="AWSDataId" value="{!scw.con.AWS_Data_Id__c}" style="display:none" />
                             </apex:column>
                             <apex:column >
                                 <apex:facet name="header">{!$Label.Department_Name}</apex:facet>
@@ -461,7 +551,7 @@
                     <tr>
                         <td>
                         <div id="iframelike2">
-                        <apex:pageBlockTable id="idAddVisitor" value="{!acwl}" var="acw" border="1" columns="7" columnsWidth="47px,90px,,90px,180x,90px,40px">
+                        <apex:pageBlockTable id="idAddVisitor" value="{!acwl}" var="acw" border="1" columns="7" onRowMouseOver="showPITR(this)" columnsWidth="47px,90px,,90px,180x,90px,40px">
                             <apex:column >
                                 <apex:facet name="header">{!$Label.Back}</apex:facet>
                                 <input type="button" id="idDel" value="{!$Label.Back}" onclick="delContact('{!acw.index}');" class="btn" style="width:40px"/>
@@ -471,6 +561,7 @@
                                 <!-- <apex:outputText id="idAddName" value="{!IF(acw.con.Name==null,'銆�',acw.con.Name)}" /> -->
                                 <apex:outputLink onmouseover="showPIDiv('{!acw.index}',this)"  onmouseout="hidePIDiv(this)" value="/{!acw.conid}" id="idAddName" target="_blank">{!IF(acw.con.Name==null,'銆�',acw.con.Name)}</apex:outputLink>
                                 <apex:inputText id="idAddHiddenId" value="{!acw.conid}" style="display:none" />
+                                <apex:inputText id="AWSDataId" value="{!acw.index}" style="display:none" />
                             </apex:column>
                             <apex:column >
                                 <apex:facet name="header">{!$Label.Department_Name}</apex:facet>
@@ -528,7 +619,9 @@
                         <th width= "80" style="text-align:right">{!$ObjectType.Lead.fields.Phone.Label}</th>
                         <td width= "80"><apex:inputField id="updateContactPhone" value="{!rc.phone}" style="width:110px" /></td>
                         <th width= "80" style="text-align:right">{!$ObjectType.Contact.fields.Supplement__c.Label}</th>
-                        <th width= "130" colspan="2" rowspan="3"><apex:inputField value="{!rc.Supplement__c}" style="width:130px" /></th>
+                        <!-- 灏唕owspan="3"鏀逛负rowspan="1" zhj 2022-12-29-->
+                        <!-- <th width= "130" colspan="2" rowspan="3"><apex:inputField value="{!rc.Supplement__c}" style="width:130px" /></th> -->
+                        <th width= "130" colspan="2" rowspan="1"><apex:inputField value="{!rc.Supplement__c}" style="width:130px" /></th>
                         
                     </tr>
                     <tr></tr>

--
Gitblit v1.9.1