buli
2022-04-26 5835379ec30b1667c4e522db9d294c9b7bb8633a
force-app/main/default/pages/NewLoanerUser.page
@@ -7,6 +7,7 @@
   <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
   <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
   <apex:includeScript value="/soap/ajax/40.0/connection.js"/>
   <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
   <!-- Update 20220317 By Yang Kaiyu End -->
   <script>
      // Update 20220317 By Yang Kaiyu Start
@@ -31,7 +32,8 @@
            console.log(accountValue);
            if(accountValue !='000000000000000'){
                let baseUrl = "/apex/SearchContactPage";
                let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue;
            let searchContactKeyWord = document.getElementById(conid).value;
                let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord;
                let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no';
                newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam);
                if (window.focus) {
@@ -48,15 +50,12 @@
         dataLinesJson = JSON.parse('{!dataLinesJson}');
         console.log('dataLinesJson = ' + dataLinesJson);
         for(var i = 0;i<dataLinesJson.length;i++){
            //if(document.getElementById('allpage:allForm:allBlock:lines:'+i+':customer') != null){
            let contactHtmlString = '<img src="/img/s.gif" onclick="searchContact(\'allPage:allForm:contactId\',\'allPage:allForm:allBlock:lines:'+i+':customer_lkid\',\'allPage:allForm:allBlock:lines:'+i+':contact_lkid\',\'allPage:allForm:allBlock:lines:'+i+':contact\')" alt="Reference Document Number Lookup" class="lookupIcon"  title="Reference Document Number Lookup (New Window)"/>';
            let lookUpNode = htmlToElement(contactHtmlString);
            console.log(lookUpNode);
            let parentNode = document.getElementById('allPage:allForm:allBlock:lines:'+i+':contact').parentNode;
            //parentNode.appendChild(lookUpNode);
            parentNode.replaceChild(lookUpNode, document.getElementById('allPage:allForm:allBlock:lines:'+i+':contact').parentNode.children[2]);
            //}
            let ii = i;
            document.getElementById('allPage:allForm:allBlock:lines:'+ii+':contact').addEventListener('click',function(){
               searchContact('allPage:allForm:contactId','allPage:allForm:allBlock:lines:'+ii+':customer_lkid','allPage:allForm:allBlock:lines:'+ii+':contactId_Hidden','allPage:allForm:allBlock:lines:'+ii+':contact');
            });
         }
            
        }
      function htmlToElement(html) {
@@ -203,8 +202,9 @@
                     <!-- Update 20220317 By Yang Kaiyu End -->
                            {!$ObjectType.loaner_user__c.fields.Contact__c.label}:
                     <!-- Update 20220317 By Yang Kaiyu Start -->
                            <apex:inputField id="contact"  value="{!line.Contact__c}" html-aws-id="{!line.Contact__r.AWS_Data_Id__c}" />
                     <!-- <apex:inputText id="contact" html-aws-id="{!line.Contact__r.AWS_Data_Id__c}" disabled="false" value="{!line.Contact__r.LastName}" ></apex:inputText>                       -->
                            <!-- <apex:inputField id="contact"  value="{!line.Contact__c}" html-aws-id="{!line.Contact__r.AWS_Data_Id__c}" /> -->
                     <apex:inputText id="contact" html-aws-id="{!line.Contact__r.AWS_Data_Id__c}" disabled="false" value="{!line.Contact__r.LastName}" ></apex:inputText>
                     <apex:inputText id="contactId_Hidden" value="{!line.Contact__c}" style="display:none"/>
                     <!-- Update 20220317 By Yang Kaiyu End -->
                            {!$ObjectType.loaner_user__c.fields.FromThePeriod__c.label}: