| | |
| | | <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; |
| | |
| | | //Initial Required Information |
| | | AWSService.sfSessionId = '{!GETSESSIONID()}'; |
| | | var staticResources = JSON.parse('{!staticResource}'); |
| | | //zhj MEBG新方案改造 2022-11-29 start |
| | | var staticResourcesV2 = JSON.parse('{!staticResourceV2}'); |
| | | //zhj MEBG新方案改造 2022-11-29 end |
| | | var requiredFieldAPIList = JSON.parse('{!requiredFieldAPIListStr}'); |
| | | var fieldAPIToLabelMap = JSON.parse('{!fieldAPIToLabelMapStr}'); |
| | | var VLookUpFields = new Set(['segment__c','Hospital__c','Oncall_Equipment__c','OwnerId']); |
| | |
| | | var queryBack = function queryBack(data) { |
| | | console.log('data = ' + data); |
| | | //document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id1:0:j_id2']").value = data.object.callerPhone; |
| | | document.getElementById(api_id_map['Caller_phone__c']).value = data.object.callerPhone; //20220404 By Chen Yanan |
| | | document.querySelector("[data-id='Responsible_Person_HP__c']").value = data.object.responsiblePersonHP; |
| | | if(document.getElementById(api_id_map['Caller_phone__c'])) |
| | | document.getElementById(api_id_map['Caller_phone__c']).value = data.object.callerPhone; //20220404 By Chen Yanan |
| | | if(document.querySelector("[data-id='Responsible_Person_HP__c']")) |
| | | document.querySelector("[data-id='Responsible_Person_HP__c']").value = data.object.responsiblePersonHP; |
| | | unblockUI(); |
| | | }; |
| | | |
| | |
| | | console.log('payloadJson=' + JSON.stringify(payloadJson)); |
| | | payloadJson.Caller_phone__c = r.object[0].callerPhone; |
| | | payloadJson.Responsible_Person_HP__c = r.object[0].responsiblePersonHP; |
| | | payloadJson.Caller_Phone_Encrypt__c = r.object[0].callerPhoneEncrypt; |
| | | payloadJson.Responsible_PersonHP_Encrypt__c = r.object[0].responsiblePersonHPEncrypt; |
| | | //zhj MEBG新方案改造 2022-11-29 start |
| | | // payloadJson.Caller_Phone_Encrypt__c = r.object[0].callerPhoneEncrypt; |
| | | // payloadJson.Responsible_PersonHP_Encrypt__c = r.object[0].responsiblePersonHPEncrypt; |
| | | //zhj MEBG新方案改造 2022-11-29 end |
| | | payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; |
| | | if (isNewMode|| {!isCloneMode} ||!'{!AWSDataId}') {//Add by Li Jun for PIPL 20220413 |
| | | payloadJson.AWS_Data_Id__c = r.object[0].dataId; |
| | | delete payloadJson.OwnerId; |
| | | } else { |
| | | payloadJson.AWS_Data_Id__c = '{!AWSDataId}'; |
| | | } |
| | | if('{!sfRecordIdForEdit}'){ |
| | | payloadJson.Id = '{!sfRecordIdForEdit}'; |
| | | } |
| | | if('{!rtTypeId}'){ |
| | | payloadJson.RecordTypeId = '{!rtTypeId}';//Add by zhj for Record Type Issue 20220421 |
| | |
| | | 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; |
| | | 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; |
| | |
| | | let obj = JSON.parse(payloadForNewPI); |
| | | obj[0].dataId = '{!AWSDataId}'; |
| | | let payloadForNewPIJson = JSON.stringify(obj); |
| | | AWSService.update(staticResources.updateUrl, onCallJson, payloadForNewPIJson, controllerSaveMethod, staticResources.token, staticResources.transactionUrl, false, insertOrUpdateBack, redirectCallBack); |
| | | //zhj MEBG新方案改造 2022-11-29 start |
| | | //AWSService.update(staticResources.updateUrl, onCallJson, payloadForNewPIJson, controllerSaveMethod, staticResources.token, staticResources.transactionUrl, false, insertOrUpdateBack, redirectCallBack); |
| | | AWSService.update(staticResourcesV2.updateUrl, onCallJson, payloadForNewPIJson, controllerSaveMethod, staticResources.token, staticResourcesV2.transactionUrl, false, insertOrUpdateBack, redirectCallBack); |
| | | //zhj MEBG新方案改造 2022-11-29 end |
| | | } |
| | | |
| | | //Insert Sensitive Information to AWS |
| | | function NewPIToAWS(onCallJson, payloadForNewPI) { |
| | | let controllerSaveMethod = '{!$RemoteAction.OnCallController.saveOnCall}'; |
| | | AWSService.insert(staticResources.newUrl, onCallJson, payloadForNewPI, controllerSaveMethod, staticResources.token, staticResources.transactionUrl, true, insertOrUpdateBack, redirectCallBack); |
| | | //zhj MEBG新方案改造 2022-11-29 start |
| | | //AWSService.insert(staticResources.newUrl, onCallJson, payloadForNewPI, controllerSaveMethod, staticResources.token, staticResources.transactionUrl,{!isNewMode}, insertOrUpdateBack, redirectCallBack); |
| | | AWSService.insert(staticResourcesV2.newUrl, onCallJson, payloadForNewPI, controllerSaveMethod, staticResourcesV2.token, staticResources.transactionUrl,{!isNewMode}, insertOrUpdateBack, redirectCallBack); |
| | | //zhj MEBG新方案改造 2022-11-29 end |
| | | } |
| | | |
| | | //Check Required Fields |
| | | 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 == '') { |
| | |
| | | } |
| | | return blankRequiredFields; |
| | | } |
| | | 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"); |
| | | } |
| | | } |
| | | //Base Process |
| | | function saveOnCallProcess(saveMode) { |
| | | EditButton(true); |
| | | redirectMode = saveMode; |
| | | console.log('redirectMode' + redirectMode); |
| | | hiddenErrorMsgNode(); |
| | |
| | | errorMsgNode.innerText = errorMsg; |
| | | errorMsgNode.className = 'pbError'; |
| | | unblockUI(); |
| | | EditButton(false); |
| | | } |
| | | |
| | | //Hide Error Message |
| | |
| | | } |
| | | return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1; |
| | | } |
| | | |
| | | function IsFormElement(e){ |
| | | |
| | | function IsFormElement(e){ |
| | | return IsFormTag(e.tagName); |
| | | } |
| | | </script> |