From e6068da47c1bef5517c9e5fdc8c726766867ad4e Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 14 七月 2023 15:10:02 +0800 Subject: [PATCH] Merge branch 'master' into LEXUpgrade2023-Deloitte --- force-app/main/default/pages/NewAndEditLead.page | 53 ++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 42 insertions(+), 11 deletions(-) diff --git a/force-app/main/default/pages/NewAndEditLead.page b/force-app/main/default/pages/NewAndEditLead.page index 3698107..1dda546 100644 --- a/force-app/main/default/pages/NewAndEditLead.page +++ b/force-app/main/default/pages/NewAndEditLead.page @@ -1,4 +1,4 @@ -<apex:page standardController="Lead" extensions="NewAndEditLeadController" id="page"> +<apex:page lightningStylesheets="true" standardController="Lead" extensions="NewAndEditLeadController" id="page"> <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}" /> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}" /> @@ -20,7 +20,8 @@ var redirectMode = 'Save';//1. Save 2. SaveAndNew var requiredAPIToChangedLabelMap = new Map(); requiredAPIToChangedLabelMap.set('LastName', '{!PIPL_Name_Label}'); - var VLookUpFields = new Set(['Hospital_Name__c', 'Department_Class__c', 'Contact_Name__c', 'Campaign__c', 'Lead_Inquiry_form__c', 'Opp_Name_Search__c']); + //var VLookUpFields = new Set(['Hospital_Name__c', 'Department_Class__c', 'Contact_Name__c', 'Campaign__c', 'Lead_Inquiry_form__c', 'Opp_Name_Search__c', 'Tender_information__c', 'Agency_Opportunity__c']); + var VLookUpFields = {! VLookUpFieldsJson}; function ProcessPI(leadJson, payloadForNewPI) { blockme(); if ({!isNewMode} || {!isCloneMode}) { @@ -121,12 +122,25 @@ let result = {} result.RecordTypeId = '{!rtTypeId}'; for (let index = 0; index < nodelist.length; index++) { - if (VLookUpFields.has(nodelist[index].getAttribute("data-id"))) { + let tag_name = nodelist[index].tagName.toLowerCase(); + if(tag_name == 'div'){ + console.log(nodelist[index]) + } + if (VLookUpFields.indexOf(nodelist[index].getAttribute("data-id")) >= 0) { console.log(nodelist[index].id.indexOf('lkwgt')); if (nodelist[index].id.indexOf('lkwgt') == -1) { let vlookUpNodeId = nodelist[index].id + '_lkid'; - let vlookUpNodeValue = document.getElementById(vlookUpNodeId).value; - result[nodelist[index].getAttribute("data-id")] = vlookUpNodeValue; + if (tag_name == 'div') { + vlookUpNodeId = nodelist[index].id.substring(0,nodelist[index].id.length-4) + '_lkid'; + } + let vlookUpNodeValue = document.getElementById(vlookUpNodeId); + let v = ''; + if(vlookUpNodeValue){ + v = vlookUpNodeValue.value; + }else{ + v = nodelist[index].value; + } + result[nodelist[index].getAttribute("data-id")] = v; } } else if (nodelist[index].type == 'checkbox') { result[nodelist[index].getAttribute("data-id")] = nodelist[index].checked; @@ -245,9 +259,9 @@ function checkRequiredFieldMsg(formData) { let blankRequiredFields = ''; for (i = 0; i < requiredFieldAPIList.length; i++) { - if (formData[requiredFieldAPIList[i]] && !VLookUpFields.has(requiredFieldAPIList[i])) { + if (formData[requiredFieldAPIList[i]] && (VLookUpFields.indexOf(requiredFieldAPIList[i]) == -1)) { continue; - }else if(VLookUpFields.has(requiredFieldAPIList[i]) && formData[requiredFieldAPIList[i]] != '000000000000000'){ + }else if((VLookUpFields.indexOf(requiredFieldAPIList[i]) != -1) && formData[requiredFieldAPIList[i]] != '000000000000000'&&formData[requiredFieldAPIList[i]] != ''){ continue; } else { let fieldAPIValue = requiredFieldAPIList[i] @@ -266,6 +280,22 @@ return blankRequiredFields; } function saveLeadProcess(saveMode) { + + // 棰勬祴绛剧害鏃heck + var days = 100; + var cfdate = document.querySelector("[data-id='Close_Forecasted_Date__c']").value; + var crdate = '{!LeadCreatedDate}'; + if (cfdate != undefined && cfdate != '') { + days = (Date.parse(cfdate) - Date.parse(crdate)) / (1000 * 3600 *24); + // alert(days); + } + + if (days < 75) { + if (!confirm('棰勬祴绛剧害鏃ュ姣斿垱寤烘棩涓嶈兘灏忎簬75澶╋紝璇风‘璁ゆ槸鍚︽寜75澶╀繚瀛橈紵')){ + return + } + } + EditButton(true); disableButtonStatus(); @@ -288,6 +318,7 @@ alertErrorMessage('{!Input_Required_Field_Msg}' + checkRequiredFieldMsgResult); return } + //3. Prepare the payload for New PI API To AWS - To Do let payloadForNewPI = getPIPayload(leadJson); @@ -443,7 +474,7 @@ <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" /> <h2 class="mainTitle">鎰忓悜缂栬緫</h2> </td> - <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;"> + <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 1.0;"> <input class="btn" type="Button" value="淇濆瓨" onclick="saveLeadProcess('Save')" /> <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveLeadProcess('SaveAndNew')" /> <apex:commandButton action="{!cancel}" value="鍙栨秷" /> @@ -613,9 +644,9 @@ unblockUI(); } - + debugger document.getElementById('topButtonRow').style = ''; -聽 聽 聽 聽 聽 document.getElementById('bottomButtonRow').style = ''; + document.getElementById('bottomButtonRow').style = ''; let previous_value = {}; jQuery(".lookupInput input").each(function(i,e){ let je =jQuery(e); @@ -741,7 +772,7 @@ <tr> <td class="pbTitle"> <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" /> </td> - <td class="pbButton" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;"> + <td class="pbButton" id="bottomButtonRow" style="pointer-events: none; opacity: 1.0;"> <input class="btn" type="Button" value="淇濆瓨" onclick="saveLeadProcess('Save')" /> <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveLeadProcess('SaveAndNew')" /> <apex:commandButton action="{!cancel}" value="鍙栨秷" /> -- Gitblit v1.9.1