From fbf3ce2885477fd0dfbd8ec6b490636dc0f680dc Mon Sep 17 00:00:00 2001
From: 涂煌豪 <997058689@qq.com>
Date: 星期五, 18 三月 2022 18:49:38 +0800
Subject: [PATCH] 先款后修-修理增加先款标识

---
 force-app/main/default/pages/NewOnCall.page |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/pages/NewOnCall.page b/force-app/main/default/pages/NewOnCall.page
index 8e63d39..2af6cb8 100644
--- a/force-app/main/default/pages/NewOnCall.page
+++ b/force-app/main/default/pages/NewOnCall.page
@@ -1,3 +1,10 @@
+<!--
+  @description       : 
+  @author            : ChangeMeIn@UserSettingsUnder.SFDoc
+  @group             : 
+  @last modified on  : 03-17-2022
+  @last modified by  : ChangeMeIn@UserSettingsUnder.SFDoc
+-->
 <apex:page standardController="On_Call__c" extensions="OnCallController" id="page">
     <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
     <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
@@ -268,6 +275,16 @@
             <script>
                 //Append Page
                 sfdcPage.appendToOnloadQueue(function () {
+                    var layoutSections = JSON.parse('{!layoutSectionsStr}');
+                    for (let m = 0; m < layoutSections.length; m++) {
+                        let layoutSection = layoutSections[m].layoutFields;
+                        for (let n = 0; n < layoutSection.length; n++) {
+                            let layoutField = layoutSection[n];
+                            if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) {
+                                document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField);
+                            }
+                        }
+                    }
                     //2. Query AWS Data by dataId 
                     console.log('Mode for onCall Page:' + {!isNewMode});
                     if (!{!isNewMode}) {
@@ -275,6 +292,36 @@
                         QueryOnCallFromAWS();
                     };
                     document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
+
+                    jQuery(".lookupInput").each(function(i,e){
+                        let je =jQuery(e).find('input');
+                        je.attr("readonly","");
+                        je.css("background","unset");
+                        
+                        let dataid = je.attr('data-id');
+                        if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return;
+                        jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">');
+                    })
+                    
+                    jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){
+                        this.className = "closeIconOn";
+                    });
+                    
+                    jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){
+                        this.className = "closeIcon"
+                    });
+                    
+                    jQuery(".lookupInput").on("click","img[generate]",function(e){
+                        let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id");
+                        let input = document.getElementById(id);
+                        if(input){
+                        	input.value = '';
+							let hidden = document.getElementById(id+'_lkid');
+                            if(hidden){
+                            	hidden.value = '';
+                            }
+                        }
+                    });
                 });
             </script>
             <div class="pbBottomButtons">

--
Gitblit v1.9.1