From 03523642de0c4f319d90d0aec8a756f9e80e6a7e Mon Sep 17 00:00:00 2001 From: Li Jun <buli@deloitte.com.cn> Date: 星期四, 17 三月 2022 21:27:47 +0800 Subject: [PATCH] PIPLFunctionDeployV2 --- force-app/main/default/pages/NewAndEditContact.page | 144 +++++++-- force-app/main/default/classes/NewRepairController.cls | 2 force-app/main/default/pages/NewRepair.page | 19 + force-app/main/default/aura/NewAgencyContact/NewAgencyContactHelper.js | 35 -- force-app/main/default/classes/NewAndEditContactController.cls | 4 force-app/main/default/pages/ViewOnCallDecrypt.page | 10 force-app/main/default/pages/UploadPdf.page | 2 force-app/main/default/pages/ViewCaseDecryptInfo.page | 1 force-app/main/default/classes/ContactTriggerHandler.cls | 15 force-app/main/default/pages/NewAndEditQIS.page | 52 ++- force-app/main/default/pages/ViewASEActivityDecryptInfo.page | 18 force-app/main/default/pages/NewAndEditCase.page | 78 ++++- force-app/main/default/pages/NewRentalApply.page | 12 force-app/main/default/pages/ViewInquiryFormDecryptInfo.page | 1 force-app/main/default/pages/NewOnCall.page | 17 + force-app/main/default/classes/SearchContactController.cls | 12 force-app/main/default/pages/ViewRentalApplyDecrypt.page | 10 force-app/main/default/pages/ViewDecryptConsumApply.page | 10 force-app/main/default/pages/NewConsumApply.page | 12 force-app/main/default/pages/StraightBackAddress.page | 23 force-app/main/default/pages/NewAndEditASEActivity.page | 124 ++++++- force-app/main/default/pages/NewAndEditInspectionReport.page | 62 +++ force-app/main/default/classes/OnCallController.cls | 37 + force-app/main/default/classes/StraightBackAddressController.cls | 11 force-app/main/default/aura/NewAgencyContact/NewAgencyContact.cmp | 4 force-app/main/default/aura/NewAgencyContact/NewAgencyContactController.js | 4 force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page | 17 + force-app/main/default/pages/ViewRepairSubOrderDecryptInfo.page | 1 force-app/main/default/staticresources/AWSService/AWSService.js | 27 + force-app/main/default/classes/RentalApplyController.cls | 5 force-app/main/default/pages/ViewConsumApplyEquipmentSetDetailDecrypt.page | 8 force-app/main/default/classes/NewAndEditInquiryFormController.cls | 2 force-app/main/default/pages/ViewAddressDecryptInfo.page | 1 force-app/main/default/classes/NewConsumApplyController.cls | 4 force-app/main/default/pages/NewAndEditAddress.page | 2 force-app/main/default/pages/NewAndEditLead.page | 24 force-app/main/default/pages/NewAndEditTenderinformation.page | 62 +++ force-app/main/default/pages/ViewRepairEncrypt.page | 10 force-app/main/default/classes/NewConsumApplyEquipSetDetailController.cls | 9 39 files changed, 682 insertions(+), 209 deletions(-) diff --git a/force-app/main/default/aura/NewAgencyContact/NewAgencyContact.cmp b/force-app/main/default/aura/NewAgencyContact/NewAgencyContact.cmp index 8be5cc8..066b6b1 100644 --- a/force-app/main/default/aura/NewAgencyContact/NewAgencyContact.cmp +++ b/force-app/main/default/aura/NewAgencyContact/NewAgencyContact.cmp @@ -9,8 +9,8 @@ <aura:attribute name="showSpinner" type="Boolean" default = "False"/> <aura:attribute name="staticResource" type="Map"/> <aura:attribute name="pi_fields_map" type="Map"/> - - + <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" /> + <ltng:require scripts="{! $Resource.jquery183minjs }" /> <div class="{! v.container_class}"> <!-- header --> diff --git a/force-app/main/default/aura/NewAgencyContact/NewAgencyContactController.js b/force-app/main/default/aura/NewAgencyContact/NewAgencyContactController.js index 8069347..5056425 100644 --- a/force-app/main/default/aura/NewAgencyContact/NewAgencyContactController.js +++ b/force-app/main/default/aura/NewAgencyContact/NewAgencyContactController.js @@ -76,6 +76,10 @@ if(rv.Data && fields.hasOwnProperty(item.field) && fields[item.field].References && fields[item.field].References.map(m=>m.value).indexOf(rv.Data.pidType) > -1){ item.value = pid; } + + if(fields.hasOwnProperty(item.field)){ + item.fi = fields[item.field]; + } } } } diff --git a/force-app/main/default/aura/NewAgencyContact/NewAgencyContactHelper.js b/force-app/main/default/aura/NewAgencyContact/NewAgencyContactHelper.js index e3d4714..9ca0c00 100644 --- a/force-app/main/default/aura/NewAgencyContact/NewAgencyContactHelper.js +++ b/force-app/main/default/aura/NewAgencyContact/NewAgencyContactHelper.js @@ -25,24 +25,10 @@ payloadForNewPI = JSON.stringify(data); } - fetch(postURL, { - method: 'POST', - body: payloadForNewPI, - headers: { - 'Content-Type': 'application/json', - 'pi-token': token - } - }).then((data) => { - console.log('data=' + JSON.stringify(data)); - return data.json(); - }).then((result) => { + AWSService.post(postURL,payloadForNewPI,function(result) { //this.insertCalloutLog(this.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(result),this.successStatus); if(callback) callback(result); - }).catch(error => { - console.log('error'); - //this.insertCalloutLog(this.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(error),this.failStatus); - console.log(error); - }); + },token); }, AwsGet : function(url, data ,callback,token){ @@ -56,22 +42,9 @@ } } - fetch(url, { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - 'pi-token': token - } - }).then((data) => { - console.log('data=' + JSON.stringify(data)); - return data.json(); - }).then((result) => { + AWSService.get(url,function(result){ //this.insertCalloutLog(this.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(result),this.successStatus); if(callback) callback(result); - }).catch(error => { - console.log('error'); - //this.insertCalloutLog(this.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(error),this.failStatus); - console.log(error); - }); + },token); } }) \ No newline at end of file diff --git a/force-app/main/default/classes/ContactTriggerHandler.cls b/force-app/main/default/classes/ContactTriggerHandler.cls index fcbbc45..c7cf9af 100644 --- a/force-app/main/default/classes/ContactTriggerHandler.cls +++ b/force-app/main/default/classes/ContactTriggerHandler.cls @@ -403,10 +403,21 @@ if(!System.Test.isRunningTest()){ // NFM606Controller.executeNotFuture('', contactIdList); if (contactIdList.size() > 0) { - NFM606Controller.callout('', contactIdList); + // NFM606Controller.callout('', contactIdList); + //娣诲姞future 鍒ゆ柇 add for pipl sushanhu 20220317 start + if (!(System.isFuture()||System.isBatch())) { + NFM606Controller.callout('', contactIdList); + } + //娣诲姞future 鍒ゆ柇 add for pipl sushanhu 20220317 end } if (interfaceUserUpsertContact.size() > 0) { - NFM606Controller.executeNotFuture('', interfaceUserUpsertContact); + // NFM606Controller.executeNotFuture('', interfaceUserUpsertContact); + //娣诲姞future 鍒ゆ柇 add for pipl sushanhu 20220316 start + if (!(System.isFuture()||System.isBatch())) { + NFM606Controller.executeNotFuture('', interfaceUserUpsertContact); + } + //娣诲姞future 鍒ゆ柇 add for pipl sushanhu 20220316 end + } } diff --git a/force-app/main/default/classes/NewAndEditContactController.cls b/force-app/main/default/classes/NewAndEditContactController.cls index 87e1afe..5df7aa7 100644 --- a/force-app/main/default/classes/NewAndEditContactController.cls +++ b/force-app/main/default/classes/NewAndEditContactController.cls @@ -22,7 +22,9 @@ system.debug(mso); mso.remove('sfdc.override'); PageReference pg = new PageReference('/003/e'); - mso.putAll(mso); + //pg.getParameters().putAll(mso); + pg.getParameters().put('RecordType',mso.get('RecordType')); + pg.getParameters().put('accid',mso.get('accid')); pg.getParameters().put('nooverride','1'); pg.setRedirect(true); return pg; diff --git a/force-app/main/default/classes/NewAndEditInquiryFormController.cls b/force-app/main/default/classes/NewAndEditInquiryFormController.cls index 1246cf2..8019170 100644 --- a/force-app/main/default/classes/NewAndEditInquiryFormController.cls +++ b/force-app/main/default/classes/NewAndEditInquiryFormController.cls @@ -46,6 +46,8 @@ Sobject sobj = Database.query(soql); Map<String, String> m = new Map<String, String>(); + + sobjId = sobjId.substring(0,sobjId.length()-3); m.put((String)sobjId, (String)sobj.get('AWS_Data_Id__c')); LookUpOverrideFieldsMapJson = JSON.serialize(m); diff --git a/force-app/main/default/classes/NewConsumApplyController.cls b/force-app/main/default/classes/NewConsumApplyController.cls index c8efb33..f9fa4a2 100644 --- a/force-app/main/default/classes/NewConsumApplyController.cls +++ b/force-app/main/default/classes/NewConsumApplyController.cls @@ -2,10 +2,11 @@ * @description : * @author : ChangeMeIn@UserSettingsUnder.SFDoc * @group : - * @last modified on : 03-10-2022 + * @last modified on : 03-17-2022 * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc **/ global without sharing class NewConsumApplyController { + public String layoutSectionsStr {get; set;}//for dynamic add readonly attribute public List <LayoutDescriberHelper.LayoutSection > layoutSections{set;get;} public String awsToken{set;get;} public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); @@ -51,6 +52,7 @@ } LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, 'Consum_Apply__c','classic'); layoutSections = LayoutWrapperValue.layoutSections; + layoutSectionsStr = JSON.serialize(layoutSections); //for dynamic add readonly attribute List<String> requiredFieldAPIList = LayoutWrapperValue.requiredFieldAPIList; Map<String,String> fieldAPIToLabelMap = LayoutWrapperValue.fieldAPIToLabelMap; requiredFieldAPIListStr = JSON.serialize(requiredFieldAPIList); diff --git a/force-app/main/default/classes/NewConsumApplyEquipSetDetailController.cls b/force-app/main/default/classes/NewConsumApplyEquipSetDetailController.cls index 99d2209..b6c54ad 100644 --- a/force-app/main/default/classes/NewConsumApplyEquipSetDetailController.cls +++ b/force-app/main/default/classes/NewConsumApplyEquipSetDetailController.cls @@ -1,4 +1,12 @@ +/** + * @description : + * @author : ChangeMeIn@UserSettingsUnder.SFDoc + * @group : + * @last modified on : 03-17-2022 + * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc +**/ global without sharing class NewConsumApplyEquipSetDetailController { + public String layoutSectionsStr {get; set;}//for dynamic add readonly attribute public List <LayoutDescriberHelper.LayoutSection > layoutSections{set;get;} public String awsToken{set;get;} public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); @@ -33,6 +41,7 @@ } LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, 'Consum_Apply_Equipment_Set_Detail__c','classic'); layoutSections = LayoutWrapperValue.layoutSections; + layoutSectionsStr = JSON.serialize(layoutSections); //for dynamic add readonly attribute List<String> requiredFieldAPIList = LayoutWrapperValue.requiredFieldAPIList; Map<String,String> fieldAPIToLabelMap = LayoutWrapperValue.fieldAPIToLabelMap; requiredFieldAPIListStr = JSON.serialize(requiredFieldAPIList); diff --git a/force-app/main/default/classes/NewRepairController.cls b/force-app/main/default/classes/NewRepairController.cls index e0391de..2e84812 100644 --- a/force-app/main/default/classes/NewRepairController.cls +++ b/force-app/main/default/classes/NewRepairController.cls @@ -4,6 +4,7 @@ *@Date: 2022-03-10 10:26:47 */ global without sharing class NewRepairController { + public String layoutSectionsStr {get; set;}//for dynamic add readonly attribute public List <LayoutDescriberHelper.LayoutSection > layoutSections{set;get;} public String awsToken{set;get;} public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); @@ -55,6 +56,7 @@ } LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, 'Repair__c','classic'); layoutSections = LayoutWrapperValue.layoutSections; + layoutSectionsStr = JSON.serialize(layoutSections); //for dynamic add readonly attribute List<String> requiredFieldAPIList = LayoutWrapperValue.requiredFieldAPIList; Map<String,String> fieldAPIToLabelMap = LayoutWrapperValue.fieldAPIToLabelMap; requiredFieldAPIListStr = JSON.serialize(requiredFieldAPIList); diff --git a/force-app/main/default/classes/OnCallController.cls b/force-app/main/default/classes/OnCallController.cls index f6beda8..de6290b 100644 --- a/force-app/main/default/classes/OnCallController.cls +++ b/force-app/main/default/classes/OnCallController.cls @@ -1,4 +1,12 @@ +/** + * @description : + * @author : ChangeMeIn@UserSettingsUnder.SFDoc + * @group : + * @last modified on : 03-17-2022 + * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc +**/ global without sharing class OnCallController { + public String layoutSectionsStr {get; set;}//for dynamic add readonly attribute public List <LayoutDescriberHelper.LayoutSection > layoutSections{set;get;} public String awsToken{set;get;} public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); @@ -37,9 +45,11 @@ }else{ //鏂板缓 rtTypeId = null; + obj.put('OwnerId',UserInfo.getUserId()); } LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, 'On_Call__c','classic'); layoutSections = LayoutWrapperValue.layoutSections; + layoutSectionsStr = JSON.serialize(layoutSections); //for dynamic add readonly attribute List<String> requiredFieldAPIList = LayoutWrapperValue.requiredFieldAPIList; Map<String,String> fieldAPIToLabelMap = LayoutWrapperValue.fieldAPIToLabelMap; requiredFieldAPIListStr = JSON.serialize(requiredFieldAPIList); @@ -66,27 +76,26 @@ On_Call__c onCallInfo = new On_Call__c(); //鑷畾涔夋牸寮忚浆鎹� for (String fieldAPI: fieldValueMap.keySet()) { - system.debug('field API'+fieldAPI); + system.debug('field API='+fieldAPI); Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); - if(String.isBlank(fieldValue)){ - continue; - } + system.debug('Field Type:'+fielddataType+' field Value='+fieldValue); if(String.valueOf(fielddataType)=='DATE'){ - onCallInfo.put(fieldAPI, Date.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)).replace('/', '-'))); + onCallInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); }else if(String.valueOf(fielddataType)=='DATETIME'){ - String dt = String.valueOf(fieldValueMap.get(fieldAPI)); - if(String.isNotBlank(dt)&&dt.contains('T')){ - dt = dt.replace('T',' '); - onCallInfo.put(fieldAPI, Datetime.valueOfGmt(dt)); - } - }else if(String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ - onCallInfo.put(fieldAPI, Decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)))); + if(String.isNotBlank(fieldValue)&&fieldValue.contains('T')){ + fieldValue = fieldValue.replace('T',' '); + onCallInfo.put(fieldAPI, Datetime.valueOfGmt(fieldValue)); + }else{ + onCallInfo.put(fieldAPI, null); + } + }else if(String.valueof(fielddataType)=='CURRENCY'|| String.valueof(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ + onCallInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?0:Decimal.valueOf(fieldValue)); } else if(String.valueof(fielddataType)=='BOOLEAN'){ onCallInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); }else { - onCallInfo.put(fieldAPI, String.valueOf(fieldValueMap.get(fieldAPI))); - } + onCallInfo.put(fieldAPI,fieldValue); + } } //2. Save Record Process diff --git a/force-app/main/default/classes/RentalApplyController.cls b/force-app/main/default/classes/RentalApplyController.cls index 1a23237..1e444f5 100644 --- a/force-app/main/default/classes/RentalApplyController.cls +++ b/force-app/main/default/classes/RentalApplyController.cls @@ -2,10 +2,11 @@ * @description : * @author : ChangeMeIn@UserSettingsUnder.SFDoc * @group : - * @last modified on : 03-11-2022 + * @last modified on : 03-17-2022 * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc **/ global without sharing class RentalApplyController { + public String layoutSectionsStr {get; set;}//for dynamic add readonly attribute public List <LayoutDescriberHelper.LayoutSection > layoutSections{set;get;} public String awsToken{set;get;} public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe(); @@ -43,9 +44,11 @@ }else{ //鏂板缓 rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); + obj.put('OwnerId',UserInfo.getUserId()); } LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, 'Rental_Apply__c','classic'); layoutSections = LayoutWrapperValue.layoutSections; + layoutSectionsStr = JSON.serialize(layoutSections); //for dynamic add readonly attribute List<String> requiredFieldAPIList = LayoutWrapperValue.requiredFieldAPIList; Map<String,String> fieldAPIToLabelMap = LayoutWrapperValue.fieldAPIToLabelMap; requiredFieldAPIListStr = JSON.serialize(requiredFieldAPIList); diff --git a/force-app/main/default/classes/SearchContactController.cls b/force-app/main/default/classes/SearchContactController.cls index e151f0b..f84e347 100644 --- a/force-app/main/default/classes/SearchContactController.cls +++ b/force-app/main/default/classes/SearchContactController.cls @@ -54,6 +54,18 @@ return resp; } + @RemoteAction + public static Response searchContactsNoPI(String contactName) { + Response resp = new Response(); + resp.status = 'fail'; + List<Contact> conListTemp = new List<Contact>([select Id,Name,Account.Name,Phone,Email from Contact where Name like :contactName]); + if(conListTemp.size() > 0){ + resp.status = 'success'; + resp.message = JSON.serialize(conListTemp); + } + return resp; + } + public class Response{ public String message{set;get;} public String status{set;get;} diff --git a/force-app/main/default/classes/StraightBackAddressController.cls b/force-app/main/default/classes/StraightBackAddressController.cls index e63368a..c2a0a89 100644 --- a/force-app/main/default/classes/StraightBackAddressController.cls +++ b/force-app/main/default/classes/StraightBackAddressController.cls @@ -100,7 +100,9 @@ * 寮�濮嬫柟娉� */ public PageReference init(){ + System.debug('RepairId-----'+RepairId); String RepairSql = makeTextRepairSql(RepairId); + System.debug('RepairSql-----'+RepairSql); try{ pc = Database.query(RepairSql); system.debug('pc = ' + pc); @@ -142,6 +144,8 @@ }catch(exception e){ //澶辫触鎻愮ず ApexPages.addMessages(e); + System.debug(e.getMessage()); + System.debug(e.getlineNumber()); } insUpdData = new Address__c(); newCon = new Contact(); @@ -232,7 +236,7 @@ try{ //淇濆瓨鏁版嵁鍒颁慨鐞嗚〃涓� Repair__c rc = new Repair__c(); - rc.id=RepairId; + rc.id = RepairId; rc.Address_AWS_Data_Id__c = tableData[i].address.AWS_Data_Id__c; rc.Contact_AWS_Data_Id__c = contactawsDataId; rc.address_Contacts__c = contactsName; @@ -350,12 +354,14 @@ List<Address__c> dataList = Database.query(AddressSql); if(dataList != null && dataList.size()> 0){ indexCou += dataList.size(); + System.debug('dataList-----'+dataList); for(Integer i = 0;i<dataList.size();i++){ String createID = dataList[i].CreatedByid; createId = createId.substring(0,15); //鍔炰簨澶勭殑鍦板潃涓嶅彲淇敼 + if(dataList[i].Address_Classification__c == '鍔炰簨澶�'){ - tableData.add(new AddressData(dataList[i],'none','none','inline')); + tableData.add(new AddressData(dataList[i],'none','none','inline')); }else{ //鍙兘鏀硅嚜宸卞垱寤虹殑鍦板潃鏁版嵁锛岀郴缁熺鐞嗗憳銆丟PI_绯荤粺绠$悊鍛楴ew 娌¢檺鍒� if(loginPerson == createId ||loginPerson == '00e10000000dzzG' ||loginPerson == '00e10000000Y3o5'){ @@ -470,7 +476,6 @@ } } //鍒ゆ柇鑱旂郴浜烘槸鍚﹂兘涓虹┖ - if(insUpdData.Contacts__c == null || String.isBlank(insUpdData.Contacts__c)){ //鍒ゆ柇鏂板缓鑱旂郴浜烘槸鍚︿负绌� if(insUpdData.Create_Contacts__c == null || String.isBlank(insUpdData.Create_Contacts__c)){ diff --git a/force-app/main/default/pages/NewAndEditASEActivity.page b/force-app/main/default/pages/NewAndEditASEActivity.page index e93ab70..558cd34 100644 --- a/force-app/main/default/pages/NewAndEditASEActivity.page +++ b/force-app/main/default/pages/NewAndEditASEActivity.page @@ -1,3 +1,10 @@ +<!-- + @description : + @author : ChangeMeIn@UserSettingsUnder.SFDoc + @group : + @last modified on : 03-17-2022 + @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc +--> <apex:page standardController="ASEActivity__c" extensions="NewAndEditASEActivityController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> @@ -72,30 +79,40 @@ queryBack:function (data) { console.log('data = ' + data); if(data.object){ - for(let f in config.AWSToSobjectNonEncryptedMap){ - let ele = GetEleByClass(config.ApiPrefix + "_"+ config.AWSToSobjectNonEncryptedMap[f]); + for(let fi in config.AWSToSobjectNonEncryptedMapKeySet){ + let f = config.AWSToSobjectNonEncryptedMapKeySet[fi]; + let ele = document.getElementById(api_id_map[config.AWSToSobjectNonEncryptedMap[f]]) if(data.object.hasOwnProperty(f) && ele){ // 澶氶�夌壒娈婂鐞� if(ele.type == 'select-multiple'){ //let me = GetEleByClass(config.ApiPrefix+'_'+field_api_name); - if(ele && data.object[f]){ - let arr = data.object[f].split(';'); - - // 缁欓殣钘忕殑select璧嬪�� - for(let op of ele.options){ - op.selected = arr.indexOf(op.value)>-1; - } - - // 鍒╃敤鎸夐挳缁欐樉绀虹殑select璧嬪�� - let ra = document.getElementById(ele.id + '_right_arrow'); - if(ra){ - ra.click(); - } - - } + if(ele ){ + //_unselected + let v = ''; + if(data.object[f]){ + v = data.object[f]; + } + + let arr = v.split(';'); + + for(let opi in ele.options){ + let op = ele.options[opi]; + if(!op)continue; + op.selected = arr.indexOf(op.value)>-1; + } + let ra = document.getElementById(ele.id + '_right_arrow'); + if(ra){ + ra.click(); + } + + } }else{ ele.value = data.object[f]; + } + + if(ele.type.indexOf("select")>-1 && ele.value){ + jQuery(ele).change() } } @@ -140,7 +157,8 @@ } var GetEleApiName = function(ele){ - for(let c of ele.classList){ + for(let ci in ele.classList){ + let c = ele.classList[ci]; if(c.indexOf(config.ApiPrefix+'_')>-1){ return c.replace(config.ApiPrefix+'_',''); } @@ -167,12 +185,24 @@ // } let phone = document.querySelector(textPhone); - if(phone && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ - error_msg += ';鐢佃瘽鍙风爜閿欒'; + if(phone ){ + if(phone.value){ + if(!/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ + error_msg += ';鐢佃瘽鍙风爜閿欒'; + } + }else{ + if(phone.previousSibling && phone.previousSibling.className.indexOf('requiredBlock')>-1){ + error_msg += ';鐢佃瘽鍙风爜閿欒'; + } + } } - for(let e of document.getElementsByTagName('select')){ - for(let op of e.options){ + let es = document.getElementsByTagName('select') + for(let ei in es){ + let e = es[ei]; + for(let opi in e.options){ + let op = e.options[opi]; + if(!op)continue; if(op.value == "*****" && op.selected){ error_msg += ';涓嬫媺妗嗕笉鑳戒富鍔ㄩ�夋嫨瀵嗘枃閫夐」'; } @@ -211,9 +241,9 @@ v = ele.value; } - if(v && v != "000000000000000"){ + // if(v && v != "000000000000000"){ result[field_api_name] = v; - } + // } } } else if (ele.type == 'checkbox') { @@ -316,7 +346,7 @@ // Check Required Field let checkRequiredFieldMsgResult = checkRequiredFieldMsg(sobjJson); if (checkRequiredFieldMsgResult) { - alertErrorMessage('requiredErrorMsg' + checkRequiredFieldMsgResult); + alertErrorMessage('{!$Label.Input_Required_Field_Msg}' + checkRequiredFieldMsgResult); return } // //3. Prepare the payload for New PI API To AWS - To Do @@ -394,7 +424,8 @@ function replaceSearchContactLookup() { let lookUpNode = htmlToElement(contactHtmlString); console.log(lookUpNode); - if (!{!isNewMode}) { + let eleContactValue = document.querySelector("[data-id='ReporterASE__c']").parentNode.parentNode.children[0].value; + if (!{!isNewMode} || (eleContactValue != '000000000000000')) { //1. Query Contact from AWS by AWSDataId queryContactName() } @@ -491,6 +522,16 @@ </apex:repeat> <script> 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) { + document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); + } + } + } //1. Set Last Name label //document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[2].children[0].innerText = '濮撳悕'; //2. Query AWS Data by dataId @@ -502,7 +543,36 @@ //Replace Vlookup Field replaceSearchContactLookup(); document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton"); - document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton"); + jQuery('a[data-id="OwnerId"]').remove(); + 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"> diff --git a/force-app/main/default/pages/NewAndEditAddress.page b/force-app/main/default/pages/NewAndEditAddress.page index 7af33ed..ee20ca4 100644 --- a/force-app/main/default/pages/NewAndEditAddress.page +++ b/force-app/main/default/pages/NewAndEditAddress.page @@ -439,7 +439,7 @@ je.css("background","unset"); let dataid = je.attr('data-id'); - if(['OwnerId'].indexOf(dataid) > -1) return; + if(['Province__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;">'); }) diff --git a/force-app/main/default/pages/NewAndEditCase.page b/force-app/main/default/pages/NewAndEditCase.page index 8dd8253..90dec1a 100644 --- a/force-app/main/default/pages/NewAndEditCase.page +++ b/force-app/main/default/pages/NewAndEditCase.page @@ -320,25 +320,25 @@ let sfId = document.getElementById(document.querySelector("[data-id='ContactId']").id + '_lkid').value; let contactsInfo = JSON.parse('{!contactsInfo}'); let dataId = contactsInfo[sfId]; - // let queryContactBack = function(data){ - // //To Do later - // console.log('ContactData = ' + data.object); + let queryContactBack = function(data){ + //To Do later + console.log('ContactData = ' + data.object); - // document.querySelector("[data-id='ContactId']").value = data.object.lastName; - // } - // AWSService.query(staticResourcesContact.queryUrl, dataId, queryContactBack, staticResources.token); - let url = staticResourcesContact.queryUrl + '?dataId=' + dataId; - fetch(url, { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - 'pi-token': staticResources.token - } - }).then((data) => { - return data.json(); - }).then((result) => { - document.querySelector("[data-id='ContactId']").value = result.object.lastName; - }) + document.querySelector("[data-id='ContactId']").value = data.object.lastName; + } + AWSService.query(staticResourcesContact.queryUrl, dataId, queryContactBack, staticResources.token); + // let url = staticResourcesContact.queryUrl + '?dataId=' + dataId; + // fetch(url, { + // method: 'GET', + // headers: { + // 'Content-Type': 'application/json', + // 'pi-token': staticResources.token + // } + // }).then((data) => { + // return data.json(); + // }).then((result) => { + // document.querySelector("[data-id='ContactId']").value = result.object.lastName; + // }) } </script> <div class="bPageTitle"> @@ -403,6 +403,16 @@ </apex:repeat> <script> 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) { + document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); + } + } + } //1. Set Last Name label //document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[2].children[0].innerText = '濮撳悕'; //2. Query AWS Data by dataId @@ -419,6 +429,38 @@ document.querySelector("[data-id='RecordTypeId']").classList.add("disabledbutton"); //闇�瑕侀殣钘� // document.querySelector("[data-id='SuppliedEmail']").classList.add("displayblock"); + + jQuery('a[data-id="OwnerId"]').remove(); + + 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"> diff --git a/force-app/main/default/pages/NewAndEditContact.page b/force-app/main/default/pages/NewAndEditContact.page index ef36178..93657c4 100644 --- a/force-app/main/default/pages/NewAndEditContact.page +++ b/force-app/main/default/pages/NewAndEditContact.page @@ -1,9 +1,9 @@ -<apex:page standardController="Contact" extensions="NewAndEditContactController" id="page"> - <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> +<apex:page standardController="Contact" extensions="NewAndEditContactController" id="page" action="{!PageLoad}"> <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> + <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> <script> var config = {}; @@ -71,7 +71,8 @@ queryBack:function (data) { console.log('data = ' + data); if(data.object){ - for(let f of config.AWSToSobjectNonEncryptedMapKeySet){ + for(let fi in config.AWSToSobjectNonEncryptedMapKeySet){ + let f = config.AWSToSobjectNonEncryptedMapKeySet[fi]; let ele = document.getElementById(api_id_map[config.AWSToSobjectNonEncryptedMap[f]]) if(data.object.hasOwnProperty(f) && ele){ @@ -86,32 +87,10 @@ } let arr = v.split(';'); - - // 娓呯┖宸叉湁閫夐」 - /* - let sl = document.getElementById(ele.id + '_selected'); - if(sl){ - for(let op of sl.options){ - op.selected = true; - } - let la = document.getElementById(ele.id + '_left_arrow'); - if(la){ - la.click(); - } - } - // 璧嬪�兼柊閫夐」 - let us = document.getElementById(ele.id + '_unselected'); - if(us){ - for(let op of us.options){ - op.selected = arr.indexOf(op.value)>-1; - } - let ra = document.getElementById(ele.id + '_right_arrow'); - if(ra){ - ra.click(); - } - }*/ - for(let op of ele.options){ + for(let opi in ele.options){ + let op = ele.options[opi]; + if(!op)continue; op.selected = arr.indexOf(op.value)>-1; } let ra = document.getElementById(ele.id + '_right_arrow'); @@ -169,7 +148,8 @@ } var GetEleApiName = function(ele){ - for(let c of ele.classList){ + for(let ci in ele.classList){ + let c = ele.classList[ci]; if(c.indexOf(config.ApiPrefix+'_')>-1){ return c.replace(config.ApiPrefix+'_',''); } @@ -178,6 +158,9 @@ } function IsFormTag(tag_name){ + if (!tag_name) { + return false; + } return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1; } @@ -195,17 +178,37 @@ let textPhone = "[data-id='Phone']"; //Email let email = document.querySelector(textEmail); - if(email && email.previousSibling && email.previousSibling.className.indexOf('requiredBlock')>-1 && !/^[\w-]{3,12}@[\da-zA-Z]{2,16}\.[a-zA-Z]+$/.test(email.value)){ - error_msg += ';閭欢鏍煎紡閿欒'; + if(email ){ + if(email.value){ + if(!/^[\w-]{3,12}@[\da-zA-Z]{2,16}\.[a-zA-Z]+$/.test(email.value)){ + error_msg += ';閭欢鏍煎紡閿欒'; + } + }else{ + if(email.previousSibling && email.previousSibling.className.indexOf('requiredBlock')>-1){ + error_msg += ';閭欢鏍煎紡閿欒'; + } + } } let phone = document.querySelector(textPhone); - if(phone && phone.previousSibling && phone.previousSibling.className.indexOf('requiredBlock')>-1 && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ - error_msg += ';鐢佃瘽鍙风爜閿欒'; + if(phone ){ + if(phone.value){ + if(!/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ + error_msg += ';鐢佃瘽鍙风爜閿欒'; + } + }else{ + if(phone.previousSibling && phone.previousSibling.className.indexOf('requiredBlock')>-1){ + error_msg += ';鐢佃瘽鍙风爜閿欒'; + } + } } - for(let e of document.getElementsByTagName('select')){ - for(let op of e.options){ + let es = document.getElementsByTagName('select') + for(let ei in es){ + let e = es[ei]; + for(let opi in e.options){ + let op = e.options[opi]; + if(!op)continue; if(op.value == "*****" && op.selected){ error_msg += ';涓嬫媺妗嗕笉鑳戒富鍔ㄩ�夋嫨瀵嗘枃閫夐」'; } @@ -244,9 +247,9 @@ v = ele.value; } - if(v && v != "000000000000000"){ + // if(v && v != "000000000000000"){ result[field_api_name] = v; - } + // } } } else if (ele.type == 'checkbox') { @@ -354,7 +357,7 @@ // Check Required Field let checkRequiredFieldMsgResult = checkRequiredFieldMsg(sobjJson); if (checkRequiredFieldMsgResult) { - alertErrorMessage('requiredErrorMsg' + checkRequiredFieldMsgResult); + alertErrorMessage('{! $Label.Input_Required_Field_Msg}' + checkRequiredFieldMsgResult); return } // //3. Prepare the payload for New PI API To AWS - To Do @@ -444,7 +447,8 @@ <script> var init_nodes = document.getElementsByClassName("PIBackApi"); var api_id_map={}; - for(let e of init_nodes){ + for(let ei in init_nodes){ + let e = init_nodes[ei]; if(IsFormElement(e)){ if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){ api_id_map[GetEleApiName(e)] = e.id; @@ -454,6 +458,13 @@ } console.log(api_id_map); sfdcPage.appendToOnloadQueue(function () { + + jQuery('option').each(function(i,e){ + if(e.value == '_\x01_'){ + e.value = ''; + } + }) + //1. Set Last Name label //document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[2].children[0].innerText = '濮撳悕'; //2. Query AWS Data by dataId @@ -461,7 +472,62 @@ if (!{!isNewMode}) { blockme(); QuerySobjectFromAWS(); + }else{ + let ot = jQuery('input[data-id="OwnerId"]'); + let oi = document.getElementById(ot.attr("id")+'_lkid'); + ot.val('{!CurrentUserName}'); + ot.attr("readonly",""); + ot.css("background","unset"); + ot.css("border","0"); + ot.css("outline","0"); + + if(oi){ + oi.value = '{!CurrentUserId}' + } } + jQuery('a[data-id="OwnerId"]').remove(); + + 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 = ''; + } + } + }); + + 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) { + document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); + } + } + } + }); </script> <div class="pbBottomButtons"> diff --git a/force-app/main/default/pages/NewAndEditInspectionReport.page b/force-app/main/default/pages/NewAndEditInspectionReport.page index 5038294..333496e 100644 --- a/force-app/main/default/pages/NewAndEditInspectionReport.page +++ b/force-app/main/default/pages/NewAndEditInspectionReport.page @@ -77,7 +77,8 @@ let arr = data.object[f].split(';'); // 缁欓殣钘忕殑select璧嬪�� - for(let op of ele.options){ + for(let opi in ele.options){ + let op = ele.options[opi] op.selected = arr.indexOf(op.value)>-1; } @@ -205,9 +206,9 @@ v = ele.value; } - if(v && v != "000000000000000"){ + //if(v && v != "000000000000000"){ result[field_api_name] = v; - } + //} } } else if (ele.type == 'checkbox') { @@ -316,7 +317,7 @@ console.log('sobjJson:'+sobjJson); console.log('check:'+checkRequiredFieldMsgResult); if (checkRequiredFieldMsgResult) { - alertErrorMessage('requiredErrorMsg' + checkRequiredFieldMsgResult); + alertErrorMessage('{!$Label.Input_Required_Field_Msg}' + checkRequiredFieldMsgResult); return } // //3. Prepare the payload for New PI API To AWS - To Do @@ -412,7 +413,58 @@ if (!{!isNewMode}) { blockme(); QuerySobjectFromAWS(); - } + }else{ + let ot = jQuery('input[data-id="OwnerId"]'); + let oi = document.getElementById(ot.attr("id")+'_lkid'); + ot.val('{!CurrentUserName}'); + ot.attr("readonly",""); + ot.css("background","unset"); + ot.css("border","0"); + ot.css( "outline","0"); + jQuery('a[data-id="OwnerId"]').remove(); + if(oi){ + oi.value = '{!CurrentUserId}' + } + } + 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) { + document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); + } + } + } + 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"> diff --git a/force-app/main/default/pages/NewAndEditLead.page b/force-app/main/default/pages/NewAndEditLead.page index 86729fa..cd868a2 100644 --- a/force-app/main/default/pages/NewAndEditLead.page +++ b/force-app/main/default/pages/NewAndEditLead.page @@ -1,8 +1,8 @@ <apex:page standardController="Lead" extensions="NewAndEditLeadController" id="page"> - <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> + <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}" /> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> - <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> - <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> + <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}" /> + <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}" /> <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> <style> .disabledbutton { @@ -20,11 +20,11 @@ var redirectMode = 'Save';//1. Save 2. SaveAndNew var requiredAPIToChangedLabelMap = new Map(); requiredAPIToChangedLabelMap.set('LastName', '{!PIPL_Name_Label}'); - console.log('{!contactsInfo}'); var VLookUpFields = new Set(['Hospital_Name__c', 'Department_Class__c', 'Contact_Name__c', 'Campaign__c', 'Lead_Inquiry_form__c', 'Opp_Name_Search__c']); function ProcessPI(leadJson, payloadForNewPI) { blockme(); - if ({!isNewMode}) { + if ({!isNewMode + }) { NewPIToAWS(leadJson, payloadForNewPI) }else { UpdatePIToAWS(leadJson, payloadForNewPI) @@ -75,24 +75,28 @@ let textPhone = "[data-id='Phone']"; //Email let email = document.querySelector(textEmail); - if(email.value!='' && !/^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/.test(email.value)){ + if (email.value != '' && !/^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/.test(email.value)) { error_msg += ';閭欢鏍煎紡閿欒'; } let phone = document.querySelector(textPhone); - if(phone.value!='' && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ + if (phone.value != '' && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)) { error_msg += ';鐢佃瘽鍙风爜閿欒'; } - for(let e of document.getElementsByTagName('select')){ - for(let op of e.options){ + let es = document.getElementsByTagName('select') + for(let ei in es){ + let e = es[ei]; + for(let opi in e.options){ + let op = e.options[opi]; + if(!op)continue; if(op.value == "*****" && op.selected){ error_msg += ';涓嬫媺妗嗕笉鑳戒富鍔ㄩ�夋嫨瀵嗘枃閫夐」'; } } } - if(error_msg.length>0 && error_msg[0]== ';'){ + if (error_msg.length > 0 && error_msg[0] == ';') { error_msg = error_msg.substring(1); } diff --git a/force-app/main/default/pages/NewAndEditQIS.page b/force-app/main/default/pages/NewAndEditQIS.page index a263915..1f2a6ee 100644 --- a/force-app/main/default/pages/NewAndEditQIS.page +++ b/force-app/main/default/pages/NewAndEditQIS.page @@ -67,22 +67,28 @@ queryBack:function (data) { console.log('data = ' + data); if(data.object){ - for(let f of config.AWSToSobjectNonEncryptedMapKeySet){ + for(let fi in config.AWSToSobjectNonEncryptedMapKeySet){ + let f = config.AWSToSobjectNonEncryptedMapKeySet[fi]; let ele = document.getElementById(api_id_map[config.AWSToSobjectNonEncryptedMap[f]]) if(data.object.hasOwnProperty(f) && ele){ // 澶氶�夌壒娈婂鐞� if(ele.type == 'select-multiple'){ //let me = GetEleByClass(config.ApiPrefix+'_'+field_api_name); - if(ele && data.object[f]){ - let arr = data.object[f].split(';'); - - // 缁欓殣钘忕殑select璧嬪�� - for(let op of ele.options){ - op.selected = arr.indexOf(op.value)>-1; + if(ele ){ + //_unselected + let v = ''; + if(data.object[f]){ + v = data.object[f]; } - // 鍒╃敤鎸夐挳缁欐樉绀虹殑select璧嬪�� + let arr = v.split(';'); + + for(let opi in ele.options){ + let op = ele.options[opi]; + if(!op)continue; + op.selected = arr.indexOf(op.value)>-1; + } let ra = document.getElementById(ele.id + '_right_arrow'); if(ra){ ra.click(); @@ -106,11 +112,6 @@ else{ console.log('data.object = ' + data.object); } - - - // document.querySelector("[data-id='LastName']").value = data.object.lastName; - // document.querySelector("[data-id='Phone']").value = data.object.phone; - // document.querySelector("[data-id='Email']").value = data.object.email; }, updateMethod:"NewAndEditQISController.saveQISReport", insertMethod:"NewAndEditQISController.saveQISReport" @@ -138,7 +139,8 @@ } var GetEleApiName = function(ele){ - for(let c of ele.classList){ + for(let ci in ele.classList){ + let c = ele.classList[ci]; if(c.indexOf(config.ApiPrefix+'_')>-1){ return c.replace(config.ApiPrefix+'_',''); } @@ -147,6 +149,9 @@ } function IsFormTag(tag_name){ + if (!tag_name) { + return false; + } return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1; } @@ -173,8 +178,12 @@ error_msg += ';鑱旂郴鐢佃瘽鏍煎紡閿欒'; } - for(let e of document.getElementsByTagName('select')){ - for(let op of e.options){ + let es = document.getElementsByTagName('select') + for(let ei in es){ + let e = es[ei]; + for(let opi in e.options){ + let op = e.options[opi]; + if(!op)continue; if(op.value == "*****" && op.selected){ error_msg += ';涓嬫媺妗嗕笉鑳戒富鍔ㄩ�夋嫨瀵嗘枃閫夐」'; } @@ -213,9 +222,9 @@ v = ele.value; } - if(v && v != "000000000000000"){ + //if(v && v != "000000000000000"){ result[field_api_name] = v; - } + //} } } else if (ele.type == 'checkbox') { @@ -520,9 +529,12 @@ <script> var init_nodes = document.getElementsByClassName("PIBackApi"); var api_id_map={}; - for(let e of init_nodes){ + for(let ei in init_nodes){ + let e = init_nodes[ei]; if(IsFormElement(e)){ - api_id_map[GetEleApiName(e)] = e.id; + if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){ + api_id_map[GetEleApiName(e)] = e.id; + } } } console.log(api_id_map); diff --git a/force-app/main/default/pages/NewAndEditTenderinformation.page b/force-app/main/default/pages/NewAndEditTenderinformation.page index 8cfa411..274b8fb 100644 --- a/force-app/main/default/pages/NewAndEditTenderinformation.page +++ b/force-app/main/default/pages/NewAndEditTenderinformation.page @@ -77,7 +77,8 @@ let arr = data.object[f].split(';'); // 缁欓殣钘忕殑select璧嬪�� - for(let op of ele.options){ + for(let opi in ele.options){ + let op = ele.options[opi] op.selected = arr.indexOf(op.value)>-1; } @@ -203,9 +204,9 @@ v = ele.value; } - if(v && v != "000000000000000"){ + //if(v && v != "000000000000000"){ result[field_api_name] = v; - } + //} } } else if (ele.type == 'checkbox') { @@ -314,7 +315,7 @@ // Check Required Field let checkRequiredFieldMsgResult = checkRequiredFieldMsg(sobjJson); if (checkRequiredFieldMsgResult) { - alertErrorMessage('requiredErrorMsg' + checkRequiredFieldMsgResult); + alertErrorMessage('{!$Label.Input_Required_Field_Msg}' + checkRequiredFieldMsgResult); return } // //3. Prepare the payload for New PI API To AWS - To Do @@ -410,7 +411,58 @@ if (!{!isNewMode}) { bolckme(); QuerySobjectFromAWS(); - } + }else{ + let ot = jQuery('input[data-id="OwnerId"]'); + let oi = document.getElementById(ot.attr("id")+'_lkid'); + ot.val('{!CurrentUserName}'); + ot.attr("readonly",""); + ot.css("background","unset"); + ot.css("border","0"); + ot.css( "outline","0"); + jQuery('a[data-id="OwnerId"]').remove(); + if(oi){ + oi.value = '{!CurrentUserId}' + } + } + 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) { + document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); + } + } + } + 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"> diff --git a/force-app/main/default/pages/NewConsumApply.page b/force-app/main/default/pages/NewConsumApply.page index 88ce5be..2f89fdf 100644 --- a/force-app/main/default/pages/NewConsumApply.page +++ b/force-app/main/default/pages/NewConsumApply.page @@ -2,7 +2,7 @@ @description : @author : ChangeMeIn@UserSettingsUnder.SFDoc @group : - @last modified on : 03-11-2022 + @last modified on : 03-17-2022 @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc --> <apex:page standardController="Consum_Apply__c" extensions="NewConsumApplyController" id="page"> @@ -375,6 +375,16 @@ <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) { + document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); + } + } + } //2. Query AWS Data by dataId console.log('Mode for consumApply Page:' + {!isNewMode}); if (!{!isNewMode}) { diff --git a/force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page b/force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page index 044e42b..6f234b4 100644 --- a/force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page +++ b/force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page @@ -1,3 +1,10 @@ +<!-- + @description : + @author : ChangeMeIn@UserSettingsUnder.SFDoc + @group : + @last modified on : 03-17-2022 + @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc +--> <apex:page standardController="Consum_Apply_Equipment_Set_Detail__c" extensions="NewConsumApplyEquipSetDetailController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> @@ -270,6 +277,16 @@ <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) { + document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); + } + } + } //2. Query AWS Data by dataId console.log('Mode for consumApply Page:' + {!isNewMode}); if (!{!isNewMode}) { diff --git a/force-app/main/default/pages/NewOnCall.page b/force-app/main/default/pages/NewOnCall.page index 8e63d39..6eac16b 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-17-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)}"/> @@ -268,6 +275,16 @@ <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) { + document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); + } + } + } //2. Query AWS Data by dataId console.log('Mode for onCall Page:' + {!isNewMode}); if (!{!isNewMode}) { diff --git a/force-app/main/default/pages/NewRentalApply.page b/force-app/main/default/pages/NewRentalApply.page index c9b638e..a9ba68d 100644 --- a/force-app/main/default/pages/NewRentalApply.page +++ b/force-app/main/default/pages/NewRentalApply.page @@ -2,7 +2,7 @@ @description : @author : ChangeMeIn@UserSettingsUnder.SFDoc @group : - @last modified on : 03-11-2022 + @last modified on : 03-17-2022 @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc --> <apex:page standardController="Rental_Apply__c" extensions="RentalApplyController" id="page"> @@ -363,6 +363,16 @@ <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) { + document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); + } + } + } //2. Query AWS Data by dataId console.log('Mode for rentalApply Page:' + {!isNewMode}); if (!{!isNewMode}) { diff --git a/force-app/main/default/pages/NewRepair.page b/force-app/main/default/pages/NewRepair.page index a47b202..eefaed7 100644 --- a/force-app/main/default/pages/NewRepair.page +++ b/force-app/main/default/pages/NewRepair.page @@ -1,3 +1,10 @@ +<!-- + @description : + @author : ChangeMeIn@UserSettingsUnder.SFDoc + @group : + @last modified on : 03-17-2022 + @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc +--> <apex:page standardController="Repair__c" extensions="NewRepairController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> @@ -149,7 +156,7 @@ result[userVLookUpFields[i]] = userVlookUpNodeValue; } } - result.work_location_select__c = document.querySelector("[id='page:form:j_id30:j_id34:0:j_id35:j_id36:18:j_id37']").value; + result.work_location_select__c = document.querySelector("[id='page:form:j_id30:j_id34:1:j_id35:j_id36:18:j_id37']").value; // result.ProblemDescription__c = document.querySelector("[aria-describedby = 'cke_34']").contentWindow.document.getElementsByTagName('body')[0].innerHTML console.log(JSON.stringify(result)); return result; @@ -297,6 +304,16 @@ <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) { + document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); + } + } + } //2. Query AWS Data by dataId console.log('Mode for repair Page:' + {!isNewMode}); if (!{!isNewMode}) { diff --git a/force-app/main/default/pages/StraightBackAddress.page b/force-app/main/default/pages/StraightBackAddress.page index 9dca379..b8c278d 100644 --- a/force-app/main/default/pages/StraightBackAddress.page +++ b/force-app/main/default/pages/StraightBackAddress.page @@ -21,7 +21,7 @@ //鏇挎崲vlookup var newSearchContactWindow = null; - window.onload = () => { + window.onload = function () { document.getElementById("tab01").style.height = screen.availHeight*0.07+'px'; document.getElementById("tab02").style.height = screen.availHeight*0.53+'px'; document.getElementById("tab03").style.height = screen.availHeight*0.25+'px'; @@ -81,7 +81,7 @@ let divs = j$(e).find("div.message"); for (let i = 0; i < divs.length; i++) { for (let j = 0; j < divs[i].classList.length; j++) { - for(let cls of divs[i].classList){ + for(let cls in divs[i].classList){ if (cls.indexOf('error')>-1) { return true; } @@ -355,9 +355,14 @@ PIData[Id] = temp; }; for(var i=0;i<tableDataStr.length;i++){ - if(tableDataStr[i].address.AWS_Data_Id__c){ + if(tableDataStr[i].address.Contacts__r){ correct++; - AWSService.queryRepair(staticResource.queryUrl,tableDataStr[i].address.AWS_Data_Id__c,tableDataStr[i].address.Id,tableDataStr[i].address.Contacts__r.AWS_Data_Id__c,searchCallBack,staticResource.token); + AWSService.queryRepair(staticResource.queryUrl, + tableDataStr[i].address.AWS_Data_Id__c, + tableDataStr[i].address.Id, + tableDataStr[i].address.Contacts__r.AWS_Data_Id__c, + searchCallBack, + staticResource.token); } } var interval=self.setInterval(function (){ @@ -379,7 +384,6 @@ let queryBack = function queryBack(result) { let contacts = result.object; if(contacts == null){ - console.log('鏌ヨ鑱旂郴浜虹殑鏁版嵁 == null') return; } for(var i=0;i<result.object.length;i++){ @@ -442,7 +446,7 @@ '\n閭紪: '+PIData[awsDataId].zipCode+ '\n璇︾粏鍦板潃: '+PIData[awsDataId].detailedAddress }else{ - piInformation = '鑱旂郴浜�: '+ + piInformation = '鑱旂郴浜�: null'+ '\n鐢佃瘽: '+PIData[awsDataId].telephone+ '\n閭紪: '+PIData[awsDataId].zipCode+ '\n璇︾粏鍦板潃: '+PIData[awsDataId].detailedAddress @@ -453,12 +457,9 @@ let y=window.event.y; createDiv.style.left=x; createDiv.style.top=y; - createDiv.style.width = '100px'; - createDiv.style.height = '100px'; createDiv.style.background="#dddddd"; createDiv.style.position = "absolute"; parentNode.appendChild(createDiv); - parentNode.style.position = "relative"; } function hidePIDiv(awsDataId){ @@ -635,9 +636,9 @@ <td align="left" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;"> <apex:outputfield value="{!or.address.Customer__c}" /> </td> - <td align="left" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;" aws-data-id="{!or.address.AWS_Data_Id__c}" > + <td align="left" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;" aws-data-id="{!or.address.AWS_Data_Id__c}"> <!-- <apex:outputfield value="{!or.address.Contacts__c}" id="{!or.address.Contacts__c}_{!or.address.Id}"/> --> - <a href="#" id="{!or.address.Id}" aws-data-id="{!or.address.Contacts__r.AWS_Data_Id__c}" onmouseover="showPIDiv('{!or.address.Id}')" onmouseout="hidePIDiv('{!or.address.Id}')">{!or.address.Contacts__r.Name}</a> + <a href="#" id="{!or.address.Id}" onmouseover="showPIDiv('{!or.address.Id}')" onmouseout="hidePIDiv('{!or.address.Id}')" aws-data-id="{!or.address.Contacts__r.AWS_Data_Id__c}">{!or.address.Contacts__r.Name}</a> </td> <td align="left" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;"> <apex:outputText value="{!or.address.Telephone__c}" /> diff --git a/force-app/main/default/pages/UploadPdf.page b/force-app/main/default/pages/UploadPdf.page index cc9e50b..0b6f64c 100644 --- a/force-app/main/default/pages/UploadPdf.page +++ b/force-app/main/default/pages/UploadPdf.page @@ -96,7 +96,7 @@ 'fileName': fileName }) , function(result){ console.log("result" + JSON.stringify(result)); - + if (result.success == true) { key = result.object; diff --git a/force-app/main/default/pages/ViewASEActivityDecryptInfo.page b/force-app/main/default/pages/ViewASEActivityDecryptInfo.page index 2e1826e..81c9bdd 100644 --- a/force-app/main/default/pages/ViewASEActivityDecryptInfo.page +++ b/force-app/main/default/pages/ViewASEActivityDecryptInfo.page @@ -1,5 +1,13 @@ +<!-- + @description : + @author : ChangeMeIn@UserSettingsUnder.SFDoc + @group : + @last modified on : 03-17-2022 + @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc +--> <apex:page standardController="ASEActivity__c" extensions="NewAndEditASEActivityController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> + <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:form id="form"> <apex:pageblock id="pageBlock"> <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection"> @@ -18,18 +26,16 @@ AWSToSobjectEncryptedMap:{!AWSToSobjectEncryptedMapJson} }; var staticResources = JSON.parse('{!staticResource}'); + console.log(staticResources) var staticResourcesContact = JSON.parse('{!staticResourceContact}'); function QuerySobjectFromAWS() { + console.log('AWSDataId:'+'{!AWSDataId}') AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token); - } - - function QueryContactFromAWS() { if('{!contactAWS}' != null && '{!contactAWS}' != ''){ - console.log('staticResourcesContact .queryUrl' + staticResourcesContact .queryUrl); AWSService.query(staticResourcesContact .queryUrl, '{!contactAWS}', queryContactBack, staticResources.token); } } - + var queryContactBack = function queryContactBack(data){ if(!data.object){ console.log('data.object is ' + data.object); @@ -56,7 +62,6 @@ for(let f in config.AWSToSobjectNonEncryptedMap){ let t = "[title='"+config.ApiPrefix+config.AWSToSobjectNonEncryptedMap[f]+"']"; let ele = document.querySelector(t); - console.log(ele); if(ele){ ele.title = ''; if(data.object.hasOwnProperty(f)){ @@ -77,7 +82,6 @@ console.log('sfdcPage.appendToOnloadQueue') // document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[0].innerText = '濮撳悕' QuerySobjectFromAWS(); - QueryContactFromAWS(); }); </script> </apex:pageblock> diff --git a/force-app/main/default/pages/ViewAddressDecryptInfo.page b/force-app/main/default/pages/ViewAddressDecryptInfo.page index a9aa22d..5ad57c2 100644 --- a/force-app/main/default/pages/ViewAddressDecryptInfo.page +++ b/force-app/main/default/pages/ViewAddressDecryptInfo.page @@ -1,5 +1,6 @@ <apex:page standardController="Address__c" extensions="NewAndEditAddressController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> + <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> <apex:form id="form"> <apex:pageblock id="pageBlock"> diff --git a/force-app/main/default/pages/ViewCaseDecryptInfo.page b/force-app/main/default/pages/ViewCaseDecryptInfo.page index f523dec..edfac31 100644 --- a/force-app/main/default/pages/ViewCaseDecryptInfo.page +++ b/force-app/main/default/pages/ViewCaseDecryptInfo.page @@ -1,5 +1,6 @@ <apex:page standardController="Case" extensions="NewAndEditCaseController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> + <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:form id="form"> <apex:pageblock id="pageBlock"> <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection"> diff --git a/force-app/main/default/pages/ViewConsumApplyEquipmentSetDetailDecrypt.page b/force-app/main/default/pages/ViewConsumApplyEquipmentSetDetailDecrypt.page index 2b24f9d..e977898 100644 --- a/force-app/main/default/pages/ViewConsumApplyEquipmentSetDetailDecrypt.page +++ b/force-app/main/default/pages/ViewConsumApplyEquipmentSetDetailDecrypt.page @@ -1,5 +1,13 @@ +<!-- + @description : + @author : ChangeMeIn@UserSettingsUnder.SFDoc + @group : + @last modified on : 03-17-2022 + @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc +--> <apex:page standardController="Consum_Apply_Equipment_Set_Detail__c" extensions="NewConsumApplyEquipSetDetailController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> + <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:form id="form"> <apex:pageblock id="pageBlock"> <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection"> diff --git a/force-app/main/default/pages/ViewDecryptConsumApply.page b/force-app/main/default/pages/ViewDecryptConsumApply.page index 944b835..951d945 100644 --- a/force-app/main/default/pages/ViewDecryptConsumApply.page +++ b/force-app/main/default/pages/ViewDecryptConsumApply.page @@ -1,5 +1,13 @@ +<!-- + @description : + @author : ChangeMeIn@UserSettingsUnder.SFDoc + @group : + @last modified on : 03-17-2022 + @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc +--> <apex:page standardController="Consum_Apply__c" extensions="NewConsumApplyController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> + <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:form id="form"> <apex:pageblock id="pageBlock"> <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection"> @@ -14,7 +22,7 @@ AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token); } var queryBack = function queryBack(data) { - document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id1:0:j_id2']").innerHTML = data.object.phoneNumber; + document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id2:1:j_id3']").innerHTML = data.object.phoneNumber; document.querySelector("[data-id='direct_shippment_address__c']").innerHTML = data.object.directShippmentAddress; }; sfdcPage.appendToOnloadQueue(function () { diff --git a/force-app/main/default/pages/ViewInquiryFormDecryptInfo.page b/force-app/main/default/pages/ViewInquiryFormDecryptInfo.page index 91fedea..b155449 100644 --- a/force-app/main/default/pages/ViewInquiryFormDecryptInfo.page +++ b/force-app/main/default/pages/ViewInquiryFormDecryptInfo.page @@ -1,5 +1,6 @@ <apex:page standardController="Inquiry_form__c" extensions="NewAndEditInquiryFormController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> + <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:form id="form"> <apex:pageblock id="pageBlock"> <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection"> diff --git a/force-app/main/default/pages/ViewOnCallDecrypt.page b/force-app/main/default/pages/ViewOnCallDecrypt.page index 88fb2a1..2ddae3a 100644 --- a/force-app/main/default/pages/ViewOnCallDecrypt.page +++ b/force-app/main/default/pages/ViewOnCallDecrypt.page @@ -1,4 +1,12 @@ +<!-- + @description : + @author : ChangeMeIn@UserSettingsUnder.SFDoc + @group : + @last modified on : 03-17-2022 + @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc +--> <apex:page standardController="On_Call__c" extensions="OnCallController" id="page"> + <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> <apex:form id="form"> <apex:pageblock id="pageBlock"> @@ -14,7 +22,7 @@ AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token); } var queryBack = function queryBack(data) { - document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id1:0:j_id2']").innerHTML = data.object.callerPhone; + document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id2:1:j_id3']").innerHTML = data.object.callerPhone; document.querySelector("[data-id='Responsible_Person_HP__c']").innerHTML = data.object.responsiblePersonHP; }; sfdcPage.appendToOnloadQueue(function () { diff --git a/force-app/main/default/pages/ViewRentalApplyDecrypt.page b/force-app/main/default/pages/ViewRentalApplyDecrypt.page index 40c107e..128290d 100644 --- a/force-app/main/default/pages/ViewRentalApplyDecrypt.page +++ b/force-app/main/default/pages/ViewRentalApplyDecrypt.page @@ -1,5 +1,13 @@ +<!-- + @description : + @author : ChangeMeIn@UserSettingsUnder.SFDoc + @group : + @last modified on : 03-17-2022 + @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc +--> <apex:page standardController="Rental_Apply__c" extensions="RentalApplyController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> + <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:form id="form"> <apex:pageblock id="pageBlock"> <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection"> @@ -14,7 +22,7 @@ AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token); } var queryBack = function queryBack(data) { - document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id1:1:j_id2']").innerHTML = data.object.phoneNumber; + document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id1:0:j_id2']").innerHTML = data.object.phoneNumber; document.querySelector("[data-id='direct_shippment_address__c']").innerHTML = data.object.directShippmentAddress; }; sfdcPage.appendToOnloadQueue(function () { diff --git a/force-app/main/default/pages/ViewRepairEncrypt.page b/force-app/main/default/pages/ViewRepairEncrypt.page index 133195a..44abc94 100644 --- a/force-app/main/default/pages/ViewRepairEncrypt.page +++ b/force-app/main/default/pages/ViewRepairEncrypt.page @@ -1,5 +1,13 @@ +<!-- + @description : + @author : ChangeMeIn@UserSettingsUnder.SFDoc + @group : + @last modified on : 03-17-2022 + @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc +--> <apex:page standardController="Repair__c" extensions="NewRepairController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> + <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:form id="form"> <apex:pageblock id="pageBlock"> <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection"> @@ -9,7 +17,6 @@ </apex:repeat> </apex:pageBlockSection> <script> - debugger; var staticResources = JSON.parse('{!staticResource}'); var staticResourceContact = JSON.parse('{!staticResourceContact}'); var staticResourceAddress = JSON.parse('{!staticResourceAddress}'); @@ -38,7 +45,6 @@ } sfdcPage.appendToOnloadQueue(function () { console.log('sfdcPage.appendToOnloadQueue'); - debugger; QueryConsumApplyFromAWS(); }); </script> diff --git a/force-app/main/default/pages/ViewRepairSubOrderDecryptInfo.page b/force-app/main/default/pages/ViewRepairSubOrderDecryptInfo.page index 17dd54b..ca21741 100644 --- a/force-app/main/default/pages/ViewRepairSubOrderDecryptInfo.page +++ b/force-app/main/default/pages/ViewRepairSubOrderDecryptInfo.page @@ -1,5 +1,6 @@ <apex:page standardController="RepairSubOrder__c" extensions="NewAndEditRepairSubOrderController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> + <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:form id="form"> <apex:pageblock id="pageBlock"> <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection"> diff --git a/force-app/main/default/staticresources/AWSService/AWSService.js b/force-app/main/default/staticresources/AWSService/AWSService.js index b5e38ca..cf3be88 100644 --- a/force-app/main/default/staticresources/AWSService/AWSService.js +++ b/force-app/main/default/staticresources/AWSService/AWSService.js @@ -1,4 +1,4 @@ -var AWSService = {}; +let AWSService = {}; AWSService = { sfSessionId : '', insertModule : 'Insert AWS ', @@ -224,6 +224,28 @@ }, + get:function(queryURL, queryback, token) { + let para = { + url:queryURL, + headers: { + 'Content-Type': 'application/json', + 'pi-token': token + }, + type: "get", + success: function (data) { + AWSService.insertCalloutLog(AWSService.queryModule,queryURL,'',JSON.stringify(data),AWSService.successStatus); + queryback(data); + }, + error: function (error){ + //閿欒鐩稿叧澶勭悊 404灞炰簬璇ュ鐞嗭紙缁忔祴璇曪級 + //杩樺彲鑳芥槸"timeout", "error", "notmodified" 鍜� "parsererror"銆� + AWSService.insertCalloutLog(AWSService.queryModule,queryURL,'',JSON.stringify(error),AWSService.failStatus); + console.log(error); + } + }; + jQuery.ajax(para); + }, + //update post:function(postURL, payloadForNewPI, callback, token) { console.log('Process New PI Data'); @@ -381,4 +403,5 @@ { escape: true } ); } -}; \ No newline at end of file +}; +window.AWSService = AWSService; \ No newline at end of file -- Gitblit v1.9.1