| | |
| | | <!-- |
| | | @description : |
| | | @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | @group : |
| | | @last modified on : 03-03-2022 |
| | | @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | --> |
| | | <apex:page standardController="loaner_application__c" extensions="NewAndEditLoanerApplicationController" id="page"> |
| | | <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> |
| | | <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> |
| | |
| | | |
| | | //payloadJson.AWS_Data_Id__c = r.object[0].dataId; |
| | | payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; |
| | | if (isNewMode) { |
| | | if (isNewMode || {!isCloneMode}) { |
| | | payloadJson.AWS_Data_Id__c = r.object[0].dataId; |
| | | } else { |
| | | payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; |
| | |
| | | var VLookUpFields = {! VLookUpFieldsJson}; |
| | | function ProcessPI(sobjJson, payloadForNewPI) { |
| | | blockme(); |
| | | if ({!isNewMode}) { |
| | | if ({!isNewMode} || {!isCloneMode}) { |
| | | NewPIToAWS(sobjJson, payloadForNewPI) |
| | | }else { |
| | | UpdatePIToAWS(sobjJson, payloadForNewPI) |
| | | } |
| | | } |
| | | |
| | | 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"); |
| | | } |
| | | } |
| | | |
| | |
| | | v = ele.value; |
| | | } |
| | | |
| | | if(v && v != "000000000000000"){ |
| | | //if(v && v != "000000000000000"){ |
| | | result[field_api_name] = v; |
| | | } |
| | | //} |
| | | |
| | | } |
| | | } else if (ele.type == 'checkbox') { |
| | |
| | | function checkRequiredFieldMsg(formData) { |
| | | let blankRequiredFields = ''; |
| | | for(i = 0;i<requiredFieldAPIList.length;i++){ |
| | | if(formData[requiredFieldAPIList[i]]){ |
| | | if(formData[requiredFieldAPIList[i]] && (VLookUpFields.indexOf(requiredFieldAPIList[i]) == -1)){ |
| | | continue; |
| | | }else if((VLookUpFields.indexOf(requiredFieldAPIList[i]) != -1) && formData[requiredFieldAPIList[i]] != '000000000000000'){ |
| | | continue; |
| | | }else{ |
| | | if(blankRequiredFields == ''){ |
| | |
| | | return blankRequiredFields; |
| | | } |
| | | function saveSobjectProcess(save_and_new) { |
| | | EditButton(true); |
| | | if(save_and_new){ |
| | | config.SaveAndNew = true; |
| | | } |
| | |
| | | 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"); |
| | |
| | | <div class="ptBody"> |
| | | <div class="content"> |
| | | <img src="/img/s.gif" alt="{! SobjectLabel}" class="pageTitleIcon" title="{! SobjectLabel}" /> |
| | | <h1 class="pageType">{! SobjectLabel}<apex:outputText rendered="{!isNewMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode)}">{!$Label.Edit}</apex:outputText> |
| | | <h1 class="pageType">{! SobjectLabel}<apex:outputText rendered="{!isNewMode || isCloneMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode || isCloneMode)}">{!$Label.Edit}</apex:outputText> |
| | | <span class="titleSeparatingColon">:</span> |
| | | </h1> |
| | | <h2 class="pageDescription"> <apex:outputText rendered="{!isNewMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode)}">{!$Label.Edit}</apex:outputText>{! SobjectLabel}</h2> |
| | | <h2 class="pageDescription"> <apex:outputText rendered="{!isNewMode || isCloneMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode || isCloneMode)}">{!$Label.Edit}</apex:outputText>{! SobjectLabel}</h2> |
| | | <div class="blank"> </div> |
| | | </div> |
| | | <div class="links"> |
| | |
| | | <tr> |
| | | <td class="pbTitle"> |
| | | <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" /> |
| | | <h2 class="mainTitle">{! SobjectLabel}<apex:outputText rendered="{!isNewMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode)}">{!$Label.Edit}</apex:outputText></h2> |
| | | <h2 class="mainTitle">{! SobjectLabel}<apex:outputText rendered="{!isNewMode || isCloneMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode || isCloneMode)}">{!$Label.Edit}</apex:outputText></h2> |
| | | </td> |
| | | <td class="pbButton" id="topButtonRow"> |
| | | <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;"> |
| | | <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" /> |
| | | <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess(1)" /> |
| | | <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" /> |
| | |
| | | |
| | | <!--Each section has layoutFields, let's iterate them as well--> |
| | | <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField"> |
| | | <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!loaner_application__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" |
| | | required="{!layoutField.isRequired}" /> |
| | | <!-- <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!loaner_application__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" |
| | | required="{!layoutField.isRequired}" /> --> |
| | | <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!loaner_application__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}" |
| | | required="{!layoutField.isRequired}" /> |
| | | <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!loaner_application__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&¬(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}" |
| | | required="{!layoutField.isRequired}" /> |
| | | <apex:outputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!loaner_application__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&¬(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}" |
| | | /> |
| | | <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}"> |
| | | </apex:pageblocksectionitem> |
| | | </apex:repeat> |
| | |
| | | } |
| | | console.log(api_id_map); |
| | | 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"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //1. Set Last Name label |
| | | //document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[2].children[0].innerText = '姓名'; |
| | | //2. Query AWS Data by dataId |
| | |
| | | QuerySobjectFromAWS(); |
| | | } |
| | | //3. Set Readonly Attribute |
| | | document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton"); |
| | | document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton"); |
| | | // 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 = ''; |
| | | }); |
| | | </script> |
| | | <div class="pbBottomButtons"> |
| | |
| | | <tr> |
| | | <td class="pbTitle"> |
| | | <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" /> </td> |
| | | <td class="pbButtonb" id="bottomButtonRow"> |
| | | <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;"> |
| | | <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" /> |
| | | <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess()" /> |
| | | <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" /> |