From f5a94e721ae5a26f817f0df75065b64f1f192eb3 Mon Sep 17 00:00:00 2001 From: Li Jun <buli@deloitte.com.cn> Date: 星期一, 28 三月 2022 21:43:51 +0800 Subject: [PATCH] PIPLFunctionDeploy0328 --- force-app/main/default/pages/NewOnCall.page | 72 ++++++++++++++++++++++++++++++++--- 1 files changed, 65 insertions(+), 7 deletions(-) diff --git a/force-app/main/default/pages/NewOnCall.page b/force-app/main/default/pages/NewOnCall.page index 8e63d39..73b64c5 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-24-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)}"/> @@ -194,7 +201,7 @@ //Alert Error Message function alertErrorMessage(errorMsg) { - let errorMsgNode = document.getElementById("page:form:msgContent"); + let errorMsgNode = document.getElementById("page:form:block:msgContent"); errorMsg = '閿欒锛氭棤鏁堟暟鎹��' + '\n' + errorMsg; errorMsgNode.innerText = errorMsg; errorMsgNode.className = 'pbError'; @@ -203,7 +210,7 @@ //Hide Error Message function hiddenErrorMsgNode() { - let errorMsgNode = document.getElementById("page:form:msgContent"); + let errorMsgNode = document.getElementById("page:form:block:msgContent"); errorMsgNode.innerText = ''; errorMsgNode.className = ''; } @@ -229,11 +236,7 @@ <div class="ptBreadcrumb"></div> </div> <apex:form id="form"> - <!-- Error Msg--> - <apex:outputPanel id="errorMsg"> - <apex:pageMessages id="msgContent" escape="false" /> - </apex:outputPanel> - <apex:pageblock > + <apex:pageblock id="block" > <div class="pbHeader"> <table cellspacing="0" cellpadding="0" border="0"> <tbody> @@ -250,6 +253,12 @@ </tr> </tbody> </table> + </div> + <!-- Error Msg--> + <div style="text-align: center;"> + <apex:outputPanel id="errorMsg"> + <apex:pageMessages id="msgContent" escape="false" /> + </apex:outputPanel> </div> <!-- Iterate the layoutSections, which is a list of sections --> <apex:repeat value="{!layoutSections}" var="layoutSection"> @@ -268,6 +277,25 @@ <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) { + let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']"); + e.disabled = !(layoutField.editableField); + if (!(layoutField.editableField)) { + if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') { + e.parentNode.classList.add("disabledbutton"); + } + if (e.tagName == 'DIV') { + e.classList.add("disabledbutton"); + } + } + } + } + } //2. Query AWS Data by dataId console.log('Mode for onCall Page:' + {!isNewMode}); if (!{!isNewMode}) { @@ -275,6 +303,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