From 24fda5246494953a232b37547fb50bde77bd9886 Mon Sep 17 00:00:00 2001
From: Li Jun <buli@deloitte.com.cn>
Date: 星期三, 27 四月 2022 12:03:42 +0800
Subject: [PATCH] PIPLButtonIssueFix

---
 force-app/main/default/pages/NewAndEditInspectionReport.page |   49 +++++++++++++++++++++++++++++++++++++------------
 1 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/force-app/main/default/pages/NewAndEditInspectionReport.page b/force-app/main/default/pages/NewAndEditInspectionReport.page
index aa0f3cd..2e5b20e 100644
--- a/force-app/main/default/pages/NewAndEditInspectionReport.page
+++ b/force-app/main/default/pages/NewAndEditInspectionReport.page
@@ -5,6 +5,12 @@
     <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
     <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
     <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
+    <style>
+        .disabledbutton {
+            pointer-events: none;
+            opacity: 0.4;
+        }
+    </style>
     <script>
         
         var config = {};
@@ -62,6 +68,9 @@
                     delete payloadJson.OwnerId;
                 } else {
                     payloadJson.AWS_Data_Id__c = '{!AWSDataId}';
+                }
+                if('{!rtTypeId}'){
+                    payloadJson.RecordTypeId = '{!rtTypeId}';//Add by zhj for Record Type Issue 20220421
                 }
                 return payloadJson;
             },
@@ -128,6 +137,19 @@
             }
         }
 
+        function EditButton(isDisabled){
+            var topele = document.getElementById('topButtonRow');
+            var bottomele = document.getElementById('bottomButtonRow');
+
+            if (isDisabled) {
+                topele.classList.add("disabledbutton");
+                bottomele.classList.add("disabledbutton");
+            }else {
+                topele.classList.remove("disabledbutton");
+                bottomele.classList.remove("disabledbutton");
+            }
+        }
+
         var GetEleByClass = function(class_name){
             let eles = document.getElementsByClassName(class_name);
             if(eles.length > 0) return eles[0];
@@ -160,18 +182,18 @@
 
         function validateFieldValueFormate() {
             let error_msg = '';
-            let textEmail = "[data-id='Email']";
-            let textPhone = "[data-id='Phone']";
-            //Email
-            let email = document.querySelector(textEmail);
-            if(email && !/^[\w-]{3,12}@[\da-zA-Z]{2,16}\.[a-zA-Z]+$/.test(email.value)){
-                error_msg += ';閭欢鏍煎紡閿欒';
-            }
-            let phone = document.querySelector(textPhone);
+            // let textEmail = "[data-id='Email']";
+            // let textPhone = "[data-id='Phone']";
+            // //Email
+            // let email = document.querySelector(textEmail);
+            // if(email && !/^[\w-]{3,12}@[\da-zA-Z]{2,16}\.[a-zA-Z]+$/.test(email.value)){
+            //     error_msg += ';閭欢鏍煎紡閿欒';
+            // }
+            // let phone = document.querySelector(textPhone);
 
-            if(phone && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){
-                error_msg += ';鐢佃瘽鍙风爜閿欒';
-            }
+            // if(phone && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){
+            //     error_msg += ';鐢佃瘽鍙风爜閿欒';
+            // }
 
             for(let e of document.getElementsByTagName('select')){
                 for(let op of e.options){
@@ -319,6 +341,8 @@
             return blankRequiredFields;
         }
         function saveSobjectProcess(save_and_new) {
+            EditButton(true);
+
             if(save_and_new){
                 config.SaveAndNew = true;
             }
@@ -359,6 +383,7 @@
             let errorMsgNode = document.getElementById("page:form:block:msgContent");
             errorMsgNode.innerText = errorMsg;
             errorMsgNode.className = 'pbError';
+            EditButton(false);
         }
         function hiddenErrorMsgNode() {
             let errorMsgNode = document.getElementById("page:form:block:msgContent");
@@ -483,7 +508,7 @@
                     //document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton");
                     // document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton");
                     document.getElementById('topButtonRow').style = '';
-聽 聽 聽 聽 聽 聽 聽document.getElementById('bottomButtonRow').style = '';
+                    document.getElementById('bottomButtonRow').style = '';
                     
                     jQuery('a[data-id="OwnerId"]').remove();
 

--
Gitblit v1.9.1