| | |
| | | @description : |
| | | @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | @group : |
| | | @last modified on : 03-28-2022 |
| | | @last modified on : 03-30-2022 |
| | | @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | --> |
| | | <apex:page standardController="Consum_Apply__c" extensions="NewConsumApplyController" id="page"> |
| | |
| | | <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> |
| | | <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> |
| | | <apex:includeScript value="{!URLFOR($Resource.connection20)}"/> |
| | | <style> |
| | | .disabledbutton { |
| | | pointer-events: none; |
| | |
| | | var VLookUpFields = new Set(['Loaner_medical_Staff__c', 'Hospital__c', 'Strategic_dept__c', 'Account__c', 'QIS_number__c', 'OPDPlan__c', 'Campaign__c', 'Rental_Apply__c', 'Shipment_address__c', 'Dealer__c', 'Old_Consum_Apply__c', 'DeliverySlip__c', 'OwnerId', 'OPD__c']); |
| | | var userVLookUpFields = ['Person_In_Charge__c', 'applyUser__c', 'CC_EmailUser__c', 'Assign_Person__c', 'Consum_Assistant__c', 'Consum_Assistant2__c', 'Consum_Assistant3__c', 'SalesManager__c', 'ZongjianApprovalManager__c', 'BuchangApprovalManagerSales__c', 'TongkuoZongjian__c']; |
| | | var redirectMode = 'Save'; |
| | | |
| | | 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"); |
| | | } |
| | | } |
| | | |
| | | //Redirect Required Parameter |
| | | var redirectCallBack = function redirectCallBack(sfId,errorMessage) { |
| | |
| | | //Query Required Parameter |
| | | var queryBack = function queryBack(data) { |
| | | console.log('data = ' + data); |
| | | document.querySelector("[data-id='Phone_number__c']").value = data.object.phoneNumber; |
| | | document.querySelector("[data-id='direct_shippment_address__c']").value = data.object.directShippmentAddress; |
| | | if(document.querySelector("[data-id='Phone_number__c']")) |
| | | document.querySelector("[data-id='Phone_number__c']").value = data.object.phoneNumber; |
| | | if(document.querySelector("[data-id='direct_shippment_address__c']")) |
| | | document.querySelector("[data-id='direct_shippment_address__c']").value = data.object.directShippmentAddress; |
| | | unblockUI(); |
| | | }; |
| | | |
| | |
| | | payloadJson.Phone_Number_Encrypt__c = r.object[0].phoneNumberEncrypt; |
| | | payloadJson.Direct_Shippment_Address_Encrypt__c = r.object[0].directShippmentAddressEncrypt; |
| | | payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; |
| | | if (isNewMode) { |
| | | if (isNewMode || {!isCloneMode}) { |
| | | payloadJson.AWS_Data_Id__c = r.object[0].dataId; |
| | | 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; |
| | | } |
| | |
| | | // New Or Edit |
| | | function ProcessPI(consumApplyJson, payloadForNewPI) { |
| | | blockme(); |
| | | if ({!isNewMode |
| | | }) { |
| | | if ({!isNewMode} || {!isCloneMode}) { |
| | | NewPIToAWS(consumApplyJson, payloadForNewPI) |
| | | }else { |
| | | UpdatePIToAWS(consumApplyJson, payloadForNewPI) |
| | |
| | | function checkRequiredFieldMsg(formData) { |
| | | let blankRequiredFields = ''; |
| | | for (i = 0; i < requiredFieldAPIList.length; i++) { |
| | | if (formData[requiredFieldAPIList[i]]) { |
| | | if (formData[requiredFieldAPIList[i]] && !VLookUpFields.has(requiredFieldAPIList[i])) { |
| | | continue; |
| | | }else if(VLookUpFields.has(requiredFieldAPIList[i]) && formData[requiredFieldAPIList[i]] != '000000000000000'){ |
| | | continue; |
| | | } else { |
| | | if (blankRequiredFields == '') { |
| | |
| | | |
| | | //Base Process |
| | | function saveConsumApplyProcess(saveMode) { |
| | | EditButton(true); |
| | | |
| | | redirectMode = saveMode; |
| | | console.log('redirectMode' + redirectMode); |
| | | hiddenErrorMsgNode(); |
| | |
| | | errorMsgNode.innerText = errorMsg; |
| | | errorMsgNode.className = 'pbError'; |
| | | unblockUI(); |
| | | EditButton(false); |
| | | } |
| | | |
| | | //Hide Error Message |
| | |
| | | let dataId = contactsInfo[sfId]; |
| | | let url = staticResourcesContact.queryUrl + '?dataId=' + dataId; |
| | | let queryBackContactName = function queryBackContactName(result){ |
| | | document.querySelector("[data-id='Loaner_medical_Staff__c']").value = result.object.lastName; |
| | | if(document.querySelector("[data-id='Loaner_medical_Staff__c']")) |
| | | document.querySelector("[data-id='Loaner_medical_Staff__c']").value = result.object.lastName; |
| | | //document.querySelector("[data-id='LastName']").value = result.object.lastName; |
| | | }; |
| | | AWSService.query(staticResourcesContact.queryUrl, dataId, queryBackContactName, staticResourcesContact.token); |
| | |
| | | <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" /> |
| | | <h2 class="mainTitle">耗材备品申请编辑</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="保存" onclick="saveConsumApplyProcess('Save')" /> |
| | | <input class="btn" type="Button" value="保存并新建" onclick="saveConsumApplyProcess('SaveAndNew')" /> |
| | | <apex:commandButton action="{!cancel}" value="取消" /> |
| | |
| | | |
| | | <!--Each section has layoutFields, let's iterate them as well--> |
| | | <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField"> |
| | | <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" |
| | | <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}" |
| | | required="{!layoutField.isRequired}" /> |
| | | <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply__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="{!Consum_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&¬(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}" |
| | | /> |
| | | <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}"> |
| | | </apex:pageblocksectionitem> |
| | | </apex:repeat> |
| | |
| | | <script> |
| | | //Append Page |
| | | sfdcPage.appendToOnloadQueue(function () { |
| | | debugger |
| | | var layoutSections = JSON.parse('{!layoutSectionsStr}'); |
| | | for (let m = 0; m < layoutSections.length; m++) { |
| | | let layoutSection = layoutSections[m].layoutFields; |
| | |
| | | if (e.tagName == 'DIV') { |
| | | e.classList.add("disabledbutton"); |
| | | } |
| | | // let id = 'page:form:block:j_id34:10:j_id35:j_id36:0:j_id37'; |
| | | // let id2 = 'page:form:block:j_id34:9:j_id35:j_id36:0:j_id37' |
| | | // let lookUpSuffix = '_lkwgt'; |
| | | // // if(document.getElementById(id)){ |
| | | // // document.getElementById(id).classList.add("disabledbutton"); |
| | | // // document.getElementById(id + lookUpSuffix).classList.add("disabledbutton"); |
| | | // // } |
| | | // if(document.getElementById(id2)){ |
| | | // document.getElementById(id2 + lookUpSuffix).classList.add("disabledbutton"); |
| | | // } |
| | | if(document.querySelectorAll("[data-id='Old_Consum_Apply__c']")){ |
| | | document.querySelectorAll("[data-id='Old_Consum_Apply__c']")[0].classList.add("disabledbutton") |
| | | document.querySelectorAll("[data-id='Old_Consum_Apply__c']")[1].classList.add("disabledbutton") |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | //Replace Vlookup Field |
| | | replaceSearchContactLookup(); |
| | | document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); |
| | | |
| | | document.getElementById('topButtonRow').style = ''; |
| | | document.getElementById('bottomButtonRow').style = ''; |
| | | |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | |
| | | <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="保存" onclick="saveConsumApplyProcess('Save')" /> |
| | | <input class="btn" type="Button" value="保存并新建" onclick="saveConsumApplyProcess('SaveAndNew')" /> |
| | | <apex:commandButton action="{!cancel}" value="取消" /> |