From 69dc5df6ec51f6f7f6737c61d9c4c1e7757a2b96 Mon Sep 17 00:00:00 2001
From: Li Jun <buli@deloitte.com.cn>
Date: 星期四, 17 三月 2022 21:05:08 +0800
Subject: [PATCH] PIPLFixBugs0317V1
---
force-app/main/default/classes/NewAndEditLeadController.cls | 39 +
force-app/main/default/pages/ViewReportDecryptInfo.page | 3
force-app/main/default/staticresources/AWSService.resource-meta.xml | 5
force-app/main/default/pages/NewAndEditRepairSubOrder.page | 112 +++
force-app/main/default/classes/NewAndEditContactController.cls | 62 +
force-app/main/default/pages/SearchAWSContactByNamePage.page-meta.xml | 7
force-app/main/default/classes/NewAndEditCaseController.cls | 2
force-app/main/default/pages/SearchAWSContactByNamePage.page | 197 ++++++
force-app/main/default/pages/SearchVisitor.page | 1
force-app/main/default/classes/NewAndEditBaseController.cls | 19
force-app/main/default/pages/ViewContactDecryptInfo.page | 3
force-app/main/default/pages/ViewQISReportDecryptInfo.page | 1
force-app/main/default/pages/UploadPdf.page | 123 ++-
force-app/main/default/pages/NewAndEditAgencyContact.page | 94 ++
force-app/main/default/pages/SearchContactPage.page | 3
force-app/main/default/classes/ContactTriggerHandler.cls | 3
force-app/main/default/pages/FixtureRentalPDF.page | 2
force-app/main/default/pages/NewAndEditQIS.page | 15
force-app/main/default/classes/NewAndEditReportController.cls | 12
force-app/main/default/classes/NFM624Rest.cls | 2
force-app/main/default/pages/ViewAgencyContactDecryptInfo.page | 1
force-app/main/default/classes/LayoutDescriberHelper.cls | 6
force-app/main/default/pages/CM_SearchContactService.page | 32
force-app/main/default/classes/SearchContactController.cls | 2
force-app/main/default/classes/NewAndEditAddressController.cls | 6
force-app/main/default/pages/StraightBackAddress.page | 10
force-app/main/default/classes/NewAndEditQISController.cls | 2
force-app/main/default/pages/NewAndEditReport.page | 108 ++-
force-app/main/default/staticresources/AWSService/AWSService.js | 384 +++++++++++++
force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js | 14
force-app/main/default/classes/NewAndEditInquiryFormController.cls | 20
force-app/main/default/pages/NewAndEditInquiryForm.page | 163 +++-
force-app/main/default/pages/NewAndEditAddress.page | 70 ++
force-app/main/default/pages/NewAndEditLead.page | 208 ++++++
force-app/main/default/pages/ViewLeadDecryptInfo.page | 3
35 files changed, 1,475 insertions(+), 259 deletions(-)
diff --git a/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js b/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js
index 52e7b79..fff0276 100644
--- a/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js
+++ b/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js
@@ -12,8 +12,8 @@
component.set('v.allselectlist',res.allselectlist);
component.set('v.doclist',res.doclist);
// PIPL update Yin Mingjie 21/02/2022 start
- // component.find('select_agency_person').set('v.options', this.conv_selected(res.allselectlist.AgencyPerson__c));
- this.search_contact(component, event, helper,res.allselectlist.AgencyPerson__c);
+ component.find('select_agency_person').set('v.options', this.conv_selected(res.allselectlist.AgencyPerson__c));
+ // this.search_contact(component, event, helper,res.allselectlist.AgencyPerson__c);
// PIPL update Yin Mingjie 21/02/2022 end
component.find('select_department').set('v.options', this.conv_selected(res.allselectlist.Department_Cateogy__c));
component.find('select_purpose_type').set('v.options', this.conv_selected(res.allselectlist.Purpose_Type__c));
@@ -57,7 +57,11 @@
var searchUrl = result.searchUrl;
this.search_core(token,searchUrl,payload,(result)=>{
if(result.status == '0'){
- this.to_contact_list(result,contactData,component);
+ if(result.object != null){
+ this.to_contact_list(result,contactData,component);
+ }else{
+ component.set('v.login',false);
+ }
}else{
this.error('AWS search status : ' + result.status);
component.set('v.login',false);
@@ -299,8 +303,8 @@
get_agency_person_name : function(component, agency_person_value) {
// PIPL update Yin Mingjie 21/02/2022 start
- // var allselectlist = component.get('v.allselectlist.AgencyPerson__c');
- var allselectlist = component.get('v.allselectlistAgencyPerson');
+ var allselectlist = component.get('v.allselectlist.AgencyPerson__c');
+ // var allselectlist = component.get('v.allselectlistAgencyPerson');
// PIPL update Yin Mingjie 21/02/2022 end
var new_label = '';
for (var i = 0; i < allselectlist.length; i++) {
diff --git a/force-app/main/default/classes/ContactTriggerHandler.cls b/force-app/main/default/classes/ContactTriggerHandler.cls
index d5d7095..fcbbc45 100644
--- a/force-app/main/default/classes/ContactTriggerHandler.cls
+++ b/force-app/main/default/classes/ContactTriggerHandler.cls
@@ -295,6 +295,9 @@
String firstNameStr = String.isNotBlank(contact.FirstName) ? contact.FirstName:'';
String contactFullName = lastNameStr + firstNameStr;
contactFullName = contact.LastName_Encrypted__c;// 20220314 PI鏀归�� by Bright
+ if(string.isBlank(contactFullName)){
+ continue;
+ }
String accountId = String.valueOf(contact.AccountId).SubString(0,15);
Map<String,Contact> contactFullNameMap = new Map<String,Contact>();
if (accountContactMap.containsKey(accountId)) {
diff --git a/force-app/main/default/classes/LayoutDescriberHelper.cls b/force-app/main/default/classes/LayoutDescriberHelper.cls
index 94863c0..806dd48 100644
--- a/force-app/main/default/classes/LayoutDescriberHelper.cls
+++ b/force-app/main/default/classes/LayoutDescriberHelper.cls
@@ -114,6 +114,7 @@
layoutSections.get(layoutSections.size() - 2).layoutFields.add(lf);
}
if(lf.isRequired){
+ system.debug(lf.fieldAPI+' is required');
requiredFieldAPIList.add(lf.fieldAPI);
}
if(string.isBlank(lf.fieldAPI)){
@@ -130,6 +131,9 @@
for(String nameField:nameDetail){
LayoutField lf = new LayoutField();
lf.isRequired = (Boolean)fields.get('required');
+ if(nameField == 'Salutation'){
+ lf.isRequired = false;
+ }
lf.isPlaceHolder = placeholderF;
lf.editableField = isEditable;
lf.fieldAPI = nameField;
@@ -141,6 +145,7 @@
layoutSections.get(layoutSections.size() - 2).layoutFields.add(lf);
}
if(lf.isRequired){
+ system.debug(lf.fieldAPI+' is required');
requiredFieldAPIList.add(lf.fieldAPI);
}
if(string.isBlank(lf.fieldAPI)){
@@ -168,6 +173,7 @@
layoutSections.get(layoutSections.size() - 2).layoutFields.add(lf);
}
if(lf.isRequired){
+ system.debug(lf.fieldAPI+' is required');
requiredFieldAPIList.add(lf.fieldAPI);
}
if(string.isBlank(lf.fieldAPI)){
diff --git a/force-app/main/default/classes/NFM624Rest.cls b/force-app/main/default/classes/NFM624Rest.cls
index ada2b1b..8b9b01b 100644
--- a/force-app/main/default/classes/NFM624Rest.cls
+++ b/force-app/main/default/classes/NFM624Rest.cls
@@ -42,6 +42,7 @@
public String DepartmentName; //鎵�灞炵瀹�
public String RelatedDepartment; //鍏宠仈SFDC绉戝 瀹㈡埛绠$悊缂栫爜(鎵嬪啓) AgentCode_Ext__c
public String Type; //鑱岀
+ public String TypeEncrypted;//鑱岀Hash add for pipl 20220316 sushanhu
public String ContactAddress; //鑱旂郴鍦板潃
public String ContactAddressEncrypted;//鑱旂郴鍦板潃瀵嗘枃
public Boolean ForbiddenStatus; //骞冲彴鐢ㄦ埛绂佺敤鏍囪瘑
@@ -299,6 +300,7 @@
ct.LastName = gedata.Name;
ct.FirstName = '';
ct.Type__c = gedata.Type;
+ ct.Type_Encrypted__c = gedata.TypeEncrypted;//add for pipl sushanhu 20220316
ct.MobilePhone = gedata.Mobile;
ct.RegSource__c = comefrom;
ct.UnifiedI_Contact_ID__c = gedata.ContactId; //缁熶竴骞冲彴Id
diff --git a/force-app/main/default/classes/NewAndEditAddressController.cls b/force-app/main/default/classes/NewAndEditAddressController.cls
index 7311d8f..4fca044 100644
--- a/force-app/main/default/classes/NewAndEditAddressController.cls
+++ b/force-app/main/default/classes/NewAndEditAddressController.cls
@@ -27,6 +27,9 @@
public String sobjectPrefix{set;get;}
public String sobjecttypeForFrontEnd{set;get;}
public String contactsInfo {set;get;}//key sfid;value awsid
+ public String layoutSectionsStr {get; set;}
+ // public String CurrentUserId{private set; get;}
+ // public String CurrentUserName{private set; get;}
public NewAndEditAddressController(ApexPages.StandardController controller) {
isNewMode = true;
Input_Required_Field_Msg = Label.Input_Required_Field_Msg;
@@ -65,6 +68,9 @@
staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));
encryptedAPIList = piIntegration.PIFields;
sobjectPrefix = piIntegration.sobjectPrefix;
+ layoutSectionsStr = JSON.serialize(layoutSections);
+ // CurrentUserName = UserInfo.getName();
+ // CurrentUserId = UserInfo.getUserId();
}
global class Response{
diff --git a/force-app/main/default/classes/NewAndEditBaseController.cls b/force-app/main/default/classes/NewAndEditBaseController.cls
index 49c45e5..d8d41e6 100644
--- a/force-app/main/default/classes/NewAndEditBaseController.cls
+++ b/force-app/main/default/classes/NewAndEditBaseController.cls
@@ -1,12 +1,15 @@
global abstract class NewAndEditBaseController {
public List <LayoutDescriberHelper.LayoutSection > layoutSections{set;get;}
+ public String layoutSectionsStr {get; set;}//for dynamic add readonly attribute 20220316 by Mingjie
public String awsToken{set;get;}
public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
public String sobjectTypeValue {private set; get;}
public Boolean isNewMode{set;get;}
public String rtTypeId {get; set;}
public String AWSDataId{set;get;}
+ public String CurrentUserId{private set;get;}
+ public String CurrentUserName{private set;get;}
// 褰撳墠瀵硅薄鎵�鏈夌殑鍔犲瘑瀛楁闆嗗悎
public List<String> encryptedAPIList{private set;get;}
@@ -47,7 +50,7 @@
public List<String> VLookUpFields{get;private set;}
public String VLookUpFieldsJson{get{return Json.serialize(VLookUpFields);}}
public List<String> LookUpOverrideFields{get;private set;}
- public string LookUpOverrideFieldsMapJson{get;private set;}
+ public string LookUpOverrideFieldsMapJson{get; set;}
public NewAndEditBaseController(){
@@ -57,6 +60,8 @@
VLookUpFields = new List<String>();
layoutEncryptedAPIList = new List<String>();
LookUpOverrideFields = new List<String>();
+ CurrentUserName = UserInfo.getName();
+ CurrentUserId = UserInfo.getUserId();
}
protected virtual void Init(SObject obj){
@@ -98,7 +103,7 @@
rtTypeId = ApexPages.currentPage().getParameters().get('RecordType');
}
PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo(sobjectTypeValue);
- layoutEncryptedAPIList = piIntegration.PIFields;
+ //layoutEncryptedAPIList = piIntegration.PIFields;
encryptedAPIList = piIntegration.PIFields;
staticResource = JSON.serialize(piIntegration);
sobjectPrefix = piIntegration.sobjectPrefix;
@@ -117,7 +122,7 @@
system.debug(AWSToSobjectNonEncryptedMapJson);
try{
LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, sobjectTypeValue,'classic');
- layoutSections = LayoutWrapperValue.layoutSections;
+ layoutSections = LayoutWrapperValue.layoutSections;
List<String> requiredFieldAPIList = LayoutWrapperValue.requiredFieldAPIList;
Map<String,String> fieldAPIToLabelMap = LayoutWrapperValue.fieldAPIToLabelMap;
List<String> fieldApiList = new List<String>();
@@ -131,17 +136,19 @@
}
//鍦╲iew瑙e瘑section涓彧闇�鏄剧ず褰撳墠layout涓殑鍔犲瘑瀛楁
- // if (encryptedAPIList.contains(lf.fieldAPI)) {
- // layoutEncryptedAPIList.add(lf.fieldAPI);
- // }
+ if (encryptedAPIList.contains(lf.fieldAPI)) {
+ layoutEncryptedAPIList.add(lf.fieldAPI);
+ }
}
}
}
+ layoutSectionsStr = JSON.serialize(layoutSections); //for dynamic add readonly attribute 20220316 by Mingjie
fieldApiListStr = JSON.serialize(fieldApiList);
fieldAPIToLabelMapStr = JSON.serialize(fieldAPIToLabelMap);
requiredFieldAPIListStr = JSON.serialize(requiredFieldAPIList);
//awsToken = AWSServiceTool.getAWSToken();
}catch(Exception e){
+ layoutEncryptedAPIList = piIntegration.PIFields;
system.debug('Exception from get layout service:'+e.getmessage());
}
}
diff --git a/force-app/main/default/classes/NewAndEditCaseController.cls b/force-app/main/default/classes/NewAndEditCaseController.cls
index b27867a..a1a69fb 100644
--- a/force-app/main/default/classes/NewAndEditCaseController.cls
+++ b/force-app/main/default/classes/NewAndEditCaseController.cls
@@ -27,6 +27,7 @@
public String sobjectPrefix{set;get;}
public String sobjecttypeForFrontEnd{set;get;}
public String contactsInfo {set;get;}//key sfid;value awsid
+ public String layoutSectionsStr {get; set;}
public NewAndEditCaseController(ApexPages.StandardController controller) {
isNewMode = true;
Input_Required_Field_Msg = Label.Input_Required_Field_Msg;
@@ -68,6 +69,7 @@
staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));
encryptedAPIList = piIntegration.PIFields;
sobjectPrefix = piIntegration.sobjectPrefix;
+ layoutSectionsStr = JSON.serialize(layoutSections);
}
global class Response{
public String recordId{set;get;}
diff --git a/force-app/main/default/classes/NewAndEditContactController.cls b/force-app/main/default/classes/NewAndEditContactController.cls
index 59c3e6e..87e1afe 100644
--- a/force-app/main/default/classes/NewAndEditContactController.cls
+++ b/force-app/main/default/classes/NewAndEditContactController.cls
@@ -15,35 +15,43 @@
unifiedIContactID = c.UnifiedI_Contact_ID__c;
}
- // AWSToSobjectNonEncryptedMap.put('lastName', 'LastName');
- // AWSToSobjectNonEncryptedMap.put('phone', 'Phone');
- // AWSToSobjectNonEncryptedMap.put('email', 'Email');
- // AWSToSobjectNonEncryptedMap.put('medicalStaffFullName', 'MedicalStaff_Full_name__c');
- // AWSToSobjectNonEncryptedMap.put('mobilePhone', 'MobilePhone');
- // AWSToSobjectNonEncryptedMap.put('title', 'Title');
- // AWSToSobjectNonEncryptedMap.put('olyAssistantType', 'OLY_Assistant_Type__c');
- // AWSToSobjectNonEncryptedMap.put('jobCategoryPicklist', 'Job_Category_picklist__c');
- // AWSToSobjectNonEncryptedMap.put('type', 'Type__c');
- // AWSToSobjectNonEncryptedMap.put('contactAddress', 'Contact_address__c');
- // AWSToSobjectNonEncryptedMap.put('contactType', 'ContactType__c');
- // AWSToSobjectNonEncryptedMap.put('doctorDivision1', 'Doctor_Division1__c');
- // AWSToSobjectNonEncryptedMap.put('uniqueNumber', 'UniqueNumber__c');
-
- // AWSToSobjectEncryptedMap.put('lastNameEncrypt', 'LastName_Encrypted__c');
- // AWSToSobjectEncryptedMap.put('phoneEncrypt', 'Phone_Encrypted__c');
- // AWSToSobjectEncryptedMap.put('emailEncrypt', 'Email_Encrypted__c');
- // AWSToSobjectEncryptedMap.put('medicalStaffFullNameEncrypt', 'MedicalStaff_Full_name_Encrypted__c');
- // AWSToSobjectEncryptedMap.put('mobilePhoneEncrypt', 'MobilePhone_Encrypted__c');
- // AWSToSobjectEncryptedMap.put('titleEncrypt', 'Title_Encrypted__c');
- // AWSToSobjectEncryptedMap.put('olyAssistantTypeEncrypt', 'OLY_Assistant_Type_Encrypted__c');
- // AWSToSobjectEncryptedMap.put('jobCategoryPicklistEncrypt', 'Job_Category_picklist_Encrypted__c');
- // AWSToSobjectEncryptedMap.put('typeEncrypt', 'Type_Encrypted__c');
- // AWSToSobjectEncryptedMap.put('contactAddressEncrypt', 'Contact_address_Encrypted__c');
- // AWSToSobjectEncryptedMap.put('contactTypeEncrypt', 'ContactType_Encrypted__c');
- // AWSToSobjectEncryptedMap.put('doctorDivision1Encrypt', 'Doctor_Division1_Encrypted__c');
- // AWSToSobjectEncryptedMap.put('uniqueNumberEncrypt', 'UniqueNumber_Encrypted__c');
+ }
+
+ PageReference RedirectStandardPage(){
+ Map<string,string> mso = ApexPages.currentPage().getParameters();
+ system.debug(mso);
+ mso.remove('sfdc.override');
+ PageReference pg = new PageReference('/003/e');
+ mso.putAll(mso);
+ pg.getParameters().put('nooverride','1');
+ pg.setRedirect(true);
+ return pg;
}
+ public PageReference PageLoad(){
+ system.debug('rtTypeId='+rtTypeId);
+ string s = null;
+
+ if(!string.isBlank(rtTypeId)){
+ s = Schema.SObjectType.Contact.getRecordTypeInfosById().get(rtTypeId).getDeveloperName();
+ if(s == 'Agency' || s == 'Internal_staff'){
+ return RedirectStandardPage();
+ }
+ }
+ string accid = ApexPages.currentPage().getParameters().get('accid');
+ if(!string.isBlank(accid)){
+ List<Account> accs = [select RecordType.DeveloperName from account where id = :accid];
+ if(accs.size()>0){
+ s = accs[0].RecordType.DeveloperName;
+ if(s == 'Office' || s == 'AgencyContact' || s == 'Agency'){
+ return RedirectStandardPage();
+ }
+ }
+
+
+ }
+ return null;
+ }
@RemoteAction
global static Response saveContact(String leadJson,String transId,Boolean isNew) {
diff --git a/force-app/main/default/classes/NewAndEditInquiryFormController.cls b/force-app/main/default/classes/NewAndEditInquiryFormController.cls
index b3d2e0c..1246cf2 100644
--- a/force-app/main/default/classes/NewAndEditInquiryFormController.cls
+++ b/force-app/main/default/classes/NewAndEditInquiryFormController.cls
@@ -7,6 +7,7 @@
public String leadId{set;get;}//For Lead Lookup
public String staticResourceContact {get; set;}
public String staticResourceLead {get; set;}
+ public String urlCheckContactAWSid {get; set;}
public NewAndEditInquiryFormController(ApexPages.StandardController controller) {
List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Inquiry_form__c').getDescribe().fields.getMap().keyset());
// Add fields to controller. This is to avoid the SOQL error in visualforce page
@@ -26,11 +27,28 @@
staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));
//Lead淇℃伅锛堟悳绱㈡煡璇uery url鐢級
staticResourceLead = JSON.serialize(PIHelper.getPIIntegrationInfo('Lead'));
+
+ checkUrl('CF00N1000000962n8_lkid','Contact');
}
-
@RemoteAction
global static Response saveInquiryForm(String leadJson,String transId,Boolean isNew) {
return save(new Inquiry_form__c(),leadJson,transId,isNew);
}
+
+ private void checkUrl(String urlStr, String sobjType){
+ Map<String, String> urlFieldMap = new Map<String, String>();
+ urlFieldMap = ApexPages.currentPage().getParameters();
+ if (urlFieldMap.containsKey(urlStr)) {
+ String sobjId = urlFieldMap.get(urlStr);
+ String soql = 'select id,AWS_Data_Id__c from ' + sobjType;
+ soql += ' where id=\'' + sobjId + '\'';
+ Sobject sobj = Database.query(soql);
+
+ Map<String, String> m = new Map<String, String>();
+ m.put((String)sobjId, (String)sobj.get('AWS_Data_Id__c'));
+
+ LookUpOverrideFieldsMapJson = JSON.serialize(m);
+ }
+ }
}
\ No newline at end of file
diff --git a/force-app/main/default/classes/NewAndEditLeadController.cls b/force-app/main/default/classes/NewAndEditLeadController.cls
index 1ce6a1e..e5f9865 100644
--- a/force-app/main/default/classes/NewAndEditLeadController.cls
+++ b/force-app/main/default/classes/NewAndEditLeadController.cls
@@ -15,10 +15,12 @@
public Boolean isNewMode{set;get;}
public String rtTypeId {get; set;}
public String AWSDataId{set;get;}
+ public String AWSDataIdInquiryForm{set;get;}
public String contactId{set;get;}//For Lookup field
public List<String> encryptedAPIList{set;get;}
public String staticResource {get; set;}
public String staticResourceContact {get; set;}
+ public String staticResourceInquiryForm{get; set;}
public String requiredFieldAPIListStr {get; set;}
public String fieldAPIToLabelMapStr {get; set;}
public String Input_Required_Field_Msg{set;get;}
@@ -27,7 +29,12 @@
public String sobjectPrefix{set;get;}
public String sobjecttypeForFrontEnd{set;get;}
public String contactsInfo {set;get;}//key sfid;value awsid
+ public Inquiry_form__c ifc{get; private set;}
+ public String contactDataId{get; set;}
+ public String layoutSectionsStr {get; set;}
+ public String isQueryContact{get; set;}
public NewAndEditLeadController(ApexPages.StandardController controller) {
+ isQueryContact = '0';
isNewMode = true;
Input_Required_Field_Msg = Label.Input_Required_Field_Msg;
PIPL_Name_Label = Label.PIPL_Name_Label;
@@ -37,8 +44,22 @@
List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Lead').getDescribe().fields.getMap().keyset());
// Add fields to controller. This is to avoid the SOQL error in visualforce page
controller.addFields(fieldList);
- SObject obj = controller.getRecord();
- if(obj.Id != null){
+ SObject obj = controller.getRecord();
+
+ if(ApexPages.currentPage().getParameters().get('CF00N1000000962np_lkid') != null){
+ System.debug('CF00N1000000962np_lkid');
+ //浜у搧鍜ㄨ鍗曡繃鏉ョ殑
+ String InquiryFormId = ApexPages.currentPage().getParameters().get('CF00N1000000962np_lkid');
+ ifc = [select Id,AWS_Data_Id__c,Contact_Name__c,Contact_Id__c,Hospital_Name__c,Hospital_ID__c,Department_Class__c,Department_ID__c,Opp_Name_Search__c,Opp_Name_Search_ID__c,Campaign__c,
+ Campaign_ID__c,Name,Cancel_Reason__c,Phone__c,Email__c,Last_Name__c,LeadSource__c,Opportunity_Division__c,Request1__c,
+ Urgent__c from Inquiry_form__c where id = :InquiryFormId];
+ Contact c = [select AWS_Data_Id__c from Contact where id = :ifc.Contact_Id__c];
+ contactDataId = c.AWS_Data_Id__c;
+ AWSDataIdInquiryForm = ifc.AWS_Data_Id__c;
+ System.debug('ifc = ' + ifc);
+ rtTypeId = ApexPages.currentPage().getParameters().get('RecordType');
+ obj.put('OwnerId',UserInfo.getUserId());
+ }else if(obj.Id != null){
//鏇存柊
isNewMode = false;
Lead leadData = [select Id,RecordTypeId,AWS_Data_Id__c,Contact_Name__r.Id,Contact_Name__r.AWS_Data_Id__c from Lead where id =: obj.Id];
@@ -49,6 +70,18 @@
sfIdToAWSIdMap.put(String.valueof(leadData.Contact_Name__r.Id).subString(0,15),leadData.Contact_Name__r.AWS_Data_Id__c);
}
contactsInfo = JSON.serialize(sfIdToAWSIdMap);
+ }else if(ApexPages.currentPage().getParameters().get('CF00N10000006ps6f_lkid') != null){
+ //鑱旂郴浜鸿繃鏉ョ殑鐐瑰嚮鏂板缓鎰忓悜
+ isQueryContact = '1';
+ String contactId = ApexPages.currentPage().getParameters().get('CF00N10000006ps6f_lkid');
+ Lead leadData = [select Id,RecordTypeId,AWS_Data_Id__c,Contact_Name__r.Id,Contact_Name__r.AWS_Data_Id__c from Lead where id =:contactId];
+ Map<String,String> sfIdToAWSIdMap = new Map<String,String>();
+ if(leadData.Contact_Name__r.Id != null){
+ sfIdToAWSIdMap.put(String.valueof(leadData.Contact_Name__r.Id).subString(0,15),leadData.Contact_Name__r.AWS_Data_Id__c);
+ }
+ contactsInfo = JSON.serialize(sfIdToAWSIdMap);
+ rtTypeId = ApexPages.currentPage().getParameters().get('RecordType');
+ obj.put('OwnerId',UserInfo.getUserId());
}else{
//鏂板缓
rtTypeId = ApexPages.currentPage().getParameters().get('RecordType');
@@ -63,8 +96,10 @@
PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo('Lead');
staticResource = JSON.serialize(piIntegration);
staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));
+ staticResourceInquiryForm = JSON.serialize(PIHelper.getPIIntegrationInfo('Inquiry_form__c'));
encryptedAPIList = piIntegration.PIFields;
sobjectPrefix = piIntegration.sobjectPrefix;
+ layoutSectionsStr = JSON.serialize(layoutSections);
}
global class Response{
diff --git a/force-app/main/default/classes/NewAndEditQISController.cls b/force-app/main/default/classes/NewAndEditQISController.cls
index 83f7535..94bcb4f 100644
--- a/force-app/main/default/classes/NewAndEditQISController.cls
+++ b/force-app/main/default/classes/NewAndEditQISController.cls
@@ -1,5 +1,7 @@
global with sharing class NewAndEditQISController extends NewAndEditBaseController{
+ public String Input_Required_Field_Msg{set;get;}
public NewAndEditQISController(ApexPages.StandardController controller) {
+ Input_Required_Field_Msg = Label.Input_Required_Field_Msg;
List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('QIS_Report__c').getDescribe().fields.getMap().keyset());
controller.addFields(fieldList);
Init(controller.getRecord());
diff --git a/force-app/main/default/classes/NewAndEditReportController.cls b/force-app/main/default/classes/NewAndEditReportController.cls
index 53ca9f1..638443e 100644
--- a/force-app/main/default/classes/NewAndEditReportController.cls
+++ b/force-app/main/default/classes/NewAndEditReportController.cls
@@ -11,17 +11,18 @@
public String staticResourceContact {get; set;}
public String requiredFieldAPIListStr {get; set;}
public String fieldAPIToLabelMapStr {get; set;}
- public String requiredErrorMsg{set;get;}
+ public String Input_Required_Field_Msg{set;get;}
public String contactsInfo {set;get;}
public String PIPL_Input_Account_Error_Msg{set;get;}
public String SaveAndNewButtonUrl{get;private set;}
public String sobjectPrefix{get;private set;}
public String sobjecttypeForFrontEnd{set;get;}
public String sobjectId{set;get;}
+ public String layoutSectionsStr {get; set;}
public NewAndEditReportController(ApexPages.StandardController controller) {
sobjectId = [SELECT CustomObjectId,CustomObjectName FROM CustomObjectUserLicenseMetrics where CustomObjectName ='Report' limit 1].CustomObjectId;
isNewMode = true;
- requiredErrorMsg = Label.Input_Required_Field_Msg;
+ Input_Required_Field_Msg = Label.Input_Required_Field_Msg;
PIPL_Input_Account_Error_Msg = label.PIPL_Input_Account_Error_Msg;
sobjecttypeForFrontEnd = sobjectTypeValue;
//鑾峰彇鎵�鏈夊瓧娈�
@@ -77,6 +78,7 @@
encryptedAPIList = piIntegration.PIFields;
staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));
sobjectPrefix = piIntegration.sobjectPrefix;
+ layoutSectionsStr = JSON.serialize(layoutSections);
}
global class Response{
@@ -98,20 +100,22 @@
System.debug('鑷畾涔夋牸寮忚浆鎹㈠紑濮�');
//鑷畾涔夋牸寮忚浆鎹�
for (String fieldAPI: fieldValueMap.keySet()) {
- 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;
}
if(String.valueOf(fielddataType)=='DATE'){
+ System.debug('DATE fieldAPI = '+fieldAPI+' filedData = '+String.valueOf(fieldValueMap.get(fieldAPI)));
reportInfo.put(fieldAPI, Date.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)).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',' ');
reportInfo.put(fieldAPI, Datetime.valueOfGmt(dt));
- }
+ }else if(String.isNotBlank(dt)) {
+ reportInfo.put(fieldAPI, Datetime.valueOf(dt));
+ }
}else if(String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){
reportInfo.put(fieldAPI, Decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI))));
} else if(String.valueof(fielddataType)=='BOOLEAN'){
diff --git a/force-app/main/default/classes/SearchContactController.cls b/force-app/main/default/classes/SearchContactController.cls
index aa95550..e151f0b 100644
--- a/force-app/main/default/classes/SearchContactController.cls
+++ b/force-app/main/default/classes/SearchContactController.cls
@@ -43,7 +43,7 @@
}
List<String> awsDataIds = (List<String>) JSON.deserialize(awsContactIds, List<String>.class);
Map<String,Contact> awsIdToContactMapTemp = new Map<String,Contact>();
- List<Contact> conListTemp = new List<Contact>([select Id,AWS_Data_Id__c from Contact where AWS_Data_Id__c in:awsDataIds]);
+ List<Contact> conListTemp = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AWS_Data_Id__c in:awsDataIds]);
for(Contact con:conListTemp){
awsIdToContactMapTemp.put(con.AWS_Data_Id__c,con);
}
diff --git a/force-app/main/default/pages/CM_SearchContactService.page b/force-app/main/default/pages/CM_SearchContactService.page
index 9968e6b..e0bb42c 100644
--- a/force-app/main/default/pages/CM_SearchContactService.page
+++ b/force-app/main/default/pages/CM_SearchContactService.page
@@ -7,13 +7,14 @@
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<style>
- .decrypt{
- position: relative;
- text-align: left;
- display: block;
- margin-left: 5px;
- margin-top: -5px;
+ .decrypt{position: absolute;
+ top: 0;
+ left: 100%;
+ display: none;
+ text-align: left;
+ padding-left: 5px;
}
+ a:hover .decrypt{display: block;width: 150px}
</style>
<script type="text/javascript">
@@ -25,6 +26,13 @@
var now_edit_id = '';
var aws_result = {};
searchContactAll();
+ function Foo(){
+ j$('[aws-id]').each(function(i,e){
+ let awsDataId = j$(e).attr('aws-id');
+ let piInformation = 'Name:'+contact[awsDataId].lastName +'<br/>' +'Phone:'+ (contact[awsDataId].phone ? contact[awsDataId].phone :'');
+ j$(e).find('.decrypt').html(piInformation);
+ });
+ }
function preparePayloadForSearchContact(){
let searchPayload = new Object();
@@ -48,6 +56,7 @@
contact[contacts[i].dataId] = temp;
}
console.log(JSON.stringify(contact));
+ Foo();
};
AWSService.search(staticResources.searchUrl,data,searchCallBack,staticResources.token);
}
@@ -137,7 +146,7 @@
// createDiv.style.position = "absolute";
// parentNode.appendChild(createDiv);
console.log('dataId:'+dataId+'awsDataId Value:'+awsDataId);
- let piInformation = 'Name:'+contact[awsDataId].lastName +'\n' +'Phone:'+contact[awsDataId].phone
+ let piInformation = 'Name:'+contact[awsDataId].lastName +'\n' +'Phone:'+ (contact[awsDataId].phone ? contact[awsDataId].phone :'');
document.getElementById(dataId+'_'+awsDataId).innerText = piInformation;
}
@@ -260,7 +269,7 @@
<table class="edittable" border="0" style="border-collapse: collapse;width:580px;table-layout:fixed;">
<colgroup>
<col width="50px" />
- <col width="100px" />
+ <col width="200px" />
<col width="380px" />
<col width="50px" />
</colgroup>
@@ -284,10 +293,11 @@
<!-- <td><a href="#" onclick="setContact('{!lineinfo.lineNo}');" id="943114607025717249" onmouseover="showPIDiv('943114607025717249')" onmouseout="hidePIDiv('943114607025717249')">{!lineinfo.con.Name}</a></td> -->
<!-- 2022/02/15 寮犲崕寤� 瑙e瘑淇℃伅 start -->
<td>
- <a href="#" onclick="setContact('{!lineinfo.lineNo}','{!lineinfo.con.AWS_Data_Id__c}');" id="{!lineinfo.con.AWS_Data_Id__c}" onmouseover="showPIDiv('{!lineinfo.con.id}','{!lineinfo.con.AWS_Data_Id__c}')" onmouseout="hidePIDiv('{!lineinfo.con.id}','{!lineinfo.con.AWS_Data_Id__c}')">
- {!lineinfo.con.Name}
+ <a href="/{!lineinfo.con.Id}" onclick="setContact('{!lineinfo.lineNo}','{!lineinfo.con.AWS_Data_Id__c}');" aws-id="{!lineinfo.con.AWS_Data_Id__c}" style="position:relative">
+ <span class="encrypt">{!lineinfo.con.Name}</span>
+ <span class="decrypt"></span>
</a>
- <span id="{!lineinfo.con.id}_{!lineinfo.con.AWS_Data_Id__c}" class="decrypt"></span>
+
</td>
<!-- 2022/02/15 寮犲崕寤� 瑙e瘑淇℃伅 end -->
<td>{!lineinfo.con.AccountName__c}</td>
diff --git a/force-app/main/default/pages/FixtureRentalPDF.page b/force-app/main/default/pages/FixtureRentalPDF.page
index ff8c772..778049b 100644
--- a/force-app/main/default/pages/FixtureRentalPDF.page
+++ b/force-app/main/default/pages/FixtureRentalPDF.page
@@ -378,7 +378,7 @@
document.getElementById("allPage:Shippmentadress").innerHTML = data.object.directShippmentAddress;
//document.getElementById("Caller_phone__c").innerHTML = data.object.callerPhone;
- setTimeout(() => {
+ setTimeout(function() {
jsPdfDownload();
}, 1500);
}, staticResources.token);
diff --git a/force-app/main/default/pages/NewAndEditAddress.page b/force-app/main/default/pages/NewAndEditAddress.page
index d8e3c51..7af33ed 100644
--- a/force-app/main/default/pages/NewAndEditAddress.page
+++ b/force-app/main/default/pages/NewAndEditAddress.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="Address__c" extensions="NewAndEditAddressController" id="page">
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
@@ -78,13 +85,24 @@
// error_msg += ';閭欢鏍煎紡閿欒';
// }
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 += ';涓嬫媺妗嗕笉鑳戒富鍔ㄩ�夋嫨瀵嗘枃閫夐」';
}
@@ -293,7 +311,8 @@
function replaceSearchContactLookup() {
let lookUpNode = htmlToElement(contactHtmlString);
console.log(lookUpNode);
- if (!{!isNewMode}) {
+ let eleContactValue = document.querySelector("[data-id='Contacts__c']").parentNode.parentNode.children[1].value;
+ if (!{!isNewMode} || (eleContactValue != '000000000000000')) {
//1. Query Contact from AWS by AWSDataId
queryContactName()
// document.querySelector("[data-id='Contacts__c']").value = '鐜嬪';
@@ -392,6 +411,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
@@ -404,6 +433,35 @@
replaceSearchContactLookup();
//3. Set Readonly Attribute
// document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
+ 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(['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/NewAndEditAgencyContact.page b/force-app/main/default/pages/NewAndEditAgencyContact.page
index 639f9dc..2007b25 100644
--- a/force-app/main/default/pages/NewAndEditAgencyContact.page
+++ b/force-app/main/default/pages/NewAndEditAgencyContact.page
@@ -81,7 +81,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;
}
@@ -136,7 +137,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,8 +169,10 @@
error_msg += ';鐢佃瘽鍙风爜閿欒';
}
- for(let e of document.getElementsByTagName('select')){
- for(let op of e.options){
+ for(let ei in document.getElementsByTagName('select')){
+ let e = e.options[ei];
+ for(let opi in e.options){
+ let op = e.options[opi];
if(op.value == "*****" && op.selected){
error_msg += ';涓嬫媺妗嗕笉鑳戒富鍔ㄩ�夋嫨瀵嗘枃閫夐」';
}
@@ -207,9 +211,9 @@
v = ele.value;
}
- if(v && v != "000000000000000"){
+ // if(v && v != "000000000000000"){
result[field_api_name] = v;
- }
+ // }
}
} else if (ele.type == 'checkbox') {
@@ -399,18 +403,13 @@
let sfId = document.getElementById(document.querySelector("[data-id='Contact__c']").id + '_lkid').value;
let contactsInfo = JSON.parse('{!LookUpOverrideFieldsMapJson}');
let dataId = contactsInfo[sfId];
- let url = staticResourcesContact.queryUrl + '?dataId=' + dataId;
- fetch(url, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- 'pi-token': staticResources.token
+
+ AWSService.query(staticResourcesContact.queryUrl,dataId,function(result){
+ if(result.object){
+ document.querySelector("[data-id='Contact__c']").value = result.object.lastName;
}
- }).then((data) => {
- return data.json();
- }).then((result) => {
- document.querySelector("[data-id='Contact__c']").value = result.object.lastName;
- })
+
+ },staticResources.token);
}
</script>
@@ -477,6 +476,10 @@
</apex:repeat>
<script>
sfdcPage.appendToOnloadQueue(function () {
+
+ //Replace Vlookup Field
+ replaceSearchContactLookup();
+
//1. Set Last Name label
//document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[2].children[0].innerText = '濮撳悕';
//2. Query AWS Data by dataId
@@ -484,10 +487,63 @@
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);
+ }
+ }
}
- //Replace Vlookup Field
- replaceSearchContactLookup();
+
});
</script>
<div class="pbBottomButtons">
diff --git a/force-app/main/default/pages/NewAndEditInquiryForm.page b/force-app/main/default/pages/NewAndEditInquiryForm.page
index be37f91..f505ce3 100644
--- a/force-app/main/default/pages/NewAndEditInquiryForm.page
+++ b/force-app/main/default/pages/NewAndEditInquiryForm.page
@@ -84,7 +84,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;
}
@@ -141,7 +142,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+'_','');
}
@@ -176,8 +178,10 @@
}
}
- for(let e of document.getElementsByTagName('select')){
- for(let op of e.options){
+ for(let ei in document.getElementsByTagName('select')){
+ let e = document.getElementsByTagName('select')[ei];
+ for(let opi in e.options){
+ let op = e.options[opi];
if(op.value == "*****" && op.selected){
error_msg += ';涓嬫媺妗嗕笉鑳戒富鍔ㄩ�夋嫨瀵嗘枃閫夐」';
}
@@ -216,9 +220,9 @@
v = ele.value;
}
- if(v && v != "000000000000000"){
+ //if(v && v != "000000000000000"){
result[field_api_name] = v;
- }
+ //}
}
} else if (ele.type == 'checkbox') {
@@ -330,7 +334,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
@@ -356,7 +360,7 @@
errorMsgNode.className = '';
}
- var newSearchContactWindow = null;
+ var newSearchContactWindow = null;
var contactHtmlString = '<img src="/img/s.gif" onclick="searchContact(\'page:form:contactId\')" alt="Reference Document Number Lookup" class="lookupIcon" title="Reference Document Number Lookup (New Window)"/>';
function htmlToElement(html) {
var template = document.createElement('template');
@@ -408,7 +412,8 @@
function replaceSearchContactLookup() {
let lookUpNode = htmlToElement(contactHtmlString);
console.log(lookUpNode);
- if (!{!isNewMode}) {
+ let eleContactValue = document.querySelector("[data-id='Contact_Name__c']").parentNode.parentNode.children[0].value;
+ if (!{!isNewMode} || (eleContactValue != '000000000000000')) {
//1. Query Contact from AWS by AWSDataId
queryContactName()
}
@@ -420,26 +425,34 @@
function queryContactName() {
let sfId = document.getElementById(document.querySelector("[data-id='Contact_Name__c']").id + '_lkid').value;
let contactsInfo = JSON.parse('{!LookUpOverrideFieldsMapJson}');
- let dataId = contactsInfo[sfId];
- // let queryContactBack = function(data){
- // //To Do later
- // console.log('ContactData = ' + data.object);
-
- // document.querySelector("[data-id='Contact_Name__c']").value = data.object.lastName;
+ // if (contactsInfo == null){
+ // contactsInfo = JSON.parse('{!urlCheckContactAWSid}');
// }
- // 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='Contact_Name__c']").value = result.object.lastName;
- })
+ let dataId = contactsInfo[sfId];
+ // let dataId = JSON.parse('{!urlCheckContactAWSid}')
+ // if (dataId == '') {
+ // let contactsInfo = JSON.parse('{!LookUpOverrideFieldsMapJson}');
+ // dataId = contactsInfo[sfId];
+ // }
+ let queryContactBack = function(data){
+ //To Do later
+ console.log('ContactData = ' + data.object);
+
+ document.querySelector("[data-id='Contact_Name__c']").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='Contact_Name__c']").value = result.object.lastName;
+ // })
}
//For Lead Search
@@ -485,25 +498,25 @@
let sfId = document.getElementById(document.querySelector("[data-id='Lead_link__c']").id + '_lkid').value;
let leadsInfo = JSON.parse('{!LookUpOverrideFieldsMapJson}');
let dataId = leadsInfo[sfId];
- // let queryLeadBack = function(data){
- // //To Do later
- // console.log('ContactData = ' + data.object);
+ let queryLeadBack = function(data){
+ //To Do later
+ console.log('ContactData = ' + data.object);
- // document.querySelector("[data-id='Lead_link__c']").value = data.object.lastName;
- // }
- // AWSService.query(staticResourcesLead.queryUrl, dataId, queryLeadBack, staticResources.token);
- let url = staticResourcesLead.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='Lead_link__c']").value = result.object.lastName;
- })
+ document.querySelector("[data-id='Lead_link__c']").value = data.object.lastName;
+ }
+ AWSService.query(staticResourcesLead.queryUrl, dataId, queryLeadBack, staticResources.token);
+ // let url = staticResourcesLead.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='Lead_link__c']").value = result.object.lastName;
+ // })
}
</script>
@@ -571,6 +584,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
@@ -579,13 +602,57 @@
blockme();
QuerySobjectFromAWS();
unblockUI();
- }
+ }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}'
+ }
+ }
//Replace Contact Vlookup Field
replaceSearchContactLookup();
//Replace Lead Vlookup Field
replaceSearchLeadLookup();
document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton");
- document.querySelectorAll("[data-id='OwnerId']")[1].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/NewAndEditLead.page b/force-app/main/default/pages/NewAndEditLead.page
index a18feb9..86729fa 100644
--- a/force-app/main/default/pages/NewAndEditLead.page
+++ b/force-app/main/default/pages/NewAndEditLead.page
@@ -14,13 +14,14 @@
AWSService.sfSessionId = '{!GETSESSIONID()}';
var staticResources = JSON.parse('{!staticResource}');
var staticResourcesContact = JSON.parse('{!staticResourceContact}');
+ var staticResourceInquiryForm = JSON.parse('{!staticResourceInquiryForm}');
var requiredFieldAPIList = JSON.parse('{!requiredFieldAPIListStr}');
var fieldAPIToLabelMap = JSON.parse('{!fieldAPIToLabelMapStr}');
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']);
+ 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}) {
@@ -133,11 +134,15 @@
function QueryLeadFromAWS() {
AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token);
}
+ function QueryLeadFromAWSIFS() {
+ //staticResourceInquiryForm
+ AWSService.query(staticResourceInquiryForm.queryUrl, '{!AWSDataIdInquiryForm}', queryBack, staticResourceInquiryForm.token);
+ }
var queryBack = function queryBack(data) {
console.log('data = ' + data);
- document.querySelector("[data-id='LastName']").value = data.object.lastName.replace(/"/g,"");
- document.querySelector("[data-id='Phone']").value = data.object.phone.replace(/"/g,"");
- document.querySelector("[data-id='Email']").value = data.object.email.replace(/"/g,"");
+ document.querySelector("[data-id='LastName']").value = data.object.lastName == null ? '' : data.object.lastName;
+ document.querySelector("[data-id='Phone']").value = data.object.phone == null ? '' : data.object.phone;
+ document.querySelector("[data-id='Email']").value = data.object.email == null ? '' : data.object.email;
unblockUI();
};
@@ -211,7 +216,7 @@
return blankRequiredFields;
}
function saveLeadProcess(saveMode) {
-
+
disableButtonStatus();
redirectMode = saveMode;
console.log('redirectMode' + redirectMode);
@@ -298,27 +303,37 @@
queryContactName()
//document.querySelector("[data-id='Contact_Name__c']").value = '鐜嬪';
}
- let parentNode = document.querySelector("[data-id='Contact_Name__c']").parentNode;
- document.querySelector("[data-id='Contact_Name__c']").removeAttribute("onchange");
- parentNode.replaceChild(lookUpNode, document.querySelector("[data-id='Contact_Name__c']").parentNode.children[2]);
+ let parentNode = document.querySelector("[data-id='Contact_Name__c']").parentNode;
+ document.querySelector("[data-id='Contact_Name__c']").removeAttribute("onchange");
+ parentNode.replaceChild(lookUpNode, document.querySelector("[data-id='Contact_Name__c']").parentNode.children[2]);
}
function queryContactName() {
let sfId = document.getElementById(document.querySelector("[data-id='Contact_Name__c']").id + '_lkid').value;
- let contactsInfo = JSON.parse('{!contactsInfo}');
- let dataId = contactsInfo[sfId];
- 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) => {
+ let dataId = '';
+ if ('{!contactsInfo}' != '') {
+ let contactsInfo = JSON.parse('{!contactsInfo}');
+ dataId = contactsInfo[sfId];
+ } else if ('{!contactDataId}' != '') {
+ dataId = '{!contactDataId}';
+ }
+ let queryBackContactName = function queryBackContactName(result){
document.querySelector("[data-id='Contact_Name__c']").value = result.object.lastName;
- })
+ };
+ AWSService.query(staticResourcesContact.queryUrl, dataId, queryBackContactName, staticResourcesContact.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='Contact_Name__c']").value = result.object.lastName;
+ // })
}
</script>
<div class="bPageTitle">
@@ -385,19 +400,156 @@
</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
console.log('NameLabel = ' + '{!PIPL_Name_Label}')
document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[0].children[0].innerText = '{!PIPL_Name_Label}';
//2. Query AWS Data by dataId
console.log('Mode for Lead Page:' + {!isNewMode});
- if (!{!isNewMode}) {
- blockme();//for loading search by Li Jun 20220218
- QueryLeadFromAWS();
+ if (!{!isNewMode}) {
+ blockme();//for loading search by Li Jun 20220218
+ QueryLeadFromAWS();
+ }
+ //Replace Vlookup Field
+ replaceSearchContactLookup();
+ //3. Set Readonly Attribute
+ document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
+
+ //濡傛灉鏄仈绯讳汉杩囨潵鐨勭偣鍑绘柊寤烘剰鍚�
+ if('{!isQueryContact}' == '1'){
+ //鏌ユ壘瀹㈡埛濮撳悕
+ queryContactName();
+ }
+
+
+ //濡傛灉鏄骇鍝佸挩璇㈠崟杩囨潵鐨�
+ if ('{!ifc}' != '') {
+ blockme();
+ //鐘舵��
+ document.querySelector("[data-id='Status']").value = '璺熻繘涓�'
+ //浼氳璇㈤棶鍗�
+ if ('{!ifc.Id}')
+ document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:15:j_id37_lkid').value = '{!ifc.Id}'
+ if ('{!ifc.Name}')
+ document.querySelector("[data-id='Lead_Inquiry_form__c']").value = '{!ifc.Name}'
+ //瀹㈡埛濮撳悕
+ // if('{!ifc.Contact_Name__c}')
+ // document.querySelector("[data-id='Contact_Name__c']").value = '{!ifc.Contact_Name__c}'
+ if ('{!ifc.Contact_Id__c}')
+ document.getElementById(document.querySelector("[data-id='Contact_Name__c']").id + '_lkid').value = '{!ifc.Contact_Id__c}'
+ //鍖婚櫌
+ if ('{!ifc.Hospital_Name__c}')
+ document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:2:j_id37_lkold').value = '{!ifc.Hospital_Name__c}'
+ if ('{!ifc.Hospital_ID__c}')
+ document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:2:j_id37_lkid').value = '{!ifc.Hospital_ID__c}'
+ //鎴樼暐绉戝鍒嗙被
+ if ('{!ifc.Department_Class__c}')
+ document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:4:j_id37_lkold').value = '{!ifc.Department_Class__c}'
+ if ('{!ifc.Department_ID__c}')
+ document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:4:j_id37_lkid').value = '{!ifc.Department_ID__c}'
+ //宸叉湁璇环鍚嶇О
+ if ('{!ifc.Opp_Name_Search__c}')
+ document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:12:j_id37_lkold').value = '{!ifc.Opp_Name_Search__c}'
+ if ('{!ifc.Opp_Name_Search_ID__c}')
+ document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:12:j_id37_lkid').value = '{!ifc.Opp_Name_Search_ID__c}'
+ //涓昏瀛︿細
+ if ('{!ifc.Campaign__c}')
+ document.getElementById('page:form:block:j_id34:1:j_id35:j_id36:3:j_id37_lkold').value = '{!ifc.Campaign__c}'
+ if ('{!ifc.Campaign_ID__c}')
+ document.getElementById('page:form:block:j_id34:1:j_id35:j_id36:3:j_id37_lkid').value = '{!ifc.Campaign_ID__c}'
+ //鍙栨秷鍘熷洜
+ if ('{!ifc.Cancel_Reason__c}')
+ document.querySelector("[data-id='Cancel_Reason__c']").value = '{!ifc.Cancel_Reason__c}'
+ //鐢佃瘽
+ if ('{!ifc.Phone__c}')
+ document.querySelector("[data-id='Phone']").value = '{!ifc.Phone__c}'
+ //閭欢
+ if ('{!ifc.Email__c}')
+ document.querySelector("[data-id='Email']").value = '{!ifc.Email__c}'
+ //濮撳悕
+ if ('{!ifc.Last_Name__c}')
+ document.querySelector("[data-id='LastName']").value = '{!ifc.Last_Name__c}'
+ //鍜ㄨ鍗曟潵婧�
+ if ('{!ifc.LeadSource__c}' && document.querySelector("[data-id='LeadSource__c']"))
+ document.querySelector("[data-id='LeadSource__c']").value = '{!ifc.LeadSource__c}'
+ //鎰忓悜鍖哄垎
+ if ('{!ifc.Opportunity_Division__c}')
+ document.querySelector("[data-id='Opportunity_Division__c']").value = '{!ifc.Opportunity_Division__c}'
+ //濮旀墭浜嬮」
+ if ('{!ifc.Request1__c}') {
+ var Request1__c = '{!ifc.Request1__c}';
+ //璧嬪�肩粰绗簩涓閫夋
+ var array = Request1__c.split(';');
+ //璧嬪�肩粰绗簩涓閫夋
+ for (var i = 0; i < array.length; i++) {
+ for (var j = document.querySelector("[data-id='Request__c']").parentNode.children[1].children[0].children[1].children[0].children[0].options.length - 1; j >= 0; j--) {
+ if (array[i] == document.querySelector("[data-id='Request__c']").parentNode.children[1].children[0].children[1].children[0].children[0].options[j].innerHTML) {
+ var option = new Option();
+ option.text = array[i];
+ option.value = j;
+ document.querySelector("[data-id='Request__c']").parentNode.children[1].children[0].children[1].children[2].children[0].add(option);
+ }
+ }
+ }
+ //鍒犻櫎绗竴涓閫夋鐨勯噸澶嶅��
+ for (var i = 0; i < array.length; i++) {
+ for (var j = document.querySelector("[data-id='Request__c']").parentNode.children[1].children[0].children[1].children[0].children[0].options.length - 1; j >= 0; j--) {
+ if (array[i] == document.querySelector("[data-id='Request__c']").parentNode.children[1].children[0].children[1].children[0].children[0].options[j].innerHTML) {
+ document.querySelector("[data-id='Request__c']").parentNode.children[1].children[0].children[1].children[0].children[0].options[j] = null;
+ }
+ }
+ }
}
- //Replace Vlookup Field
- replaceSearchContactLookup();
- //3. Set Readonly Attribute
- document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
+ //绱ф��
+ if ('{!ifc.Urgent__c}')
+ document.querySelector("[data-id='urgent__c']").checked = '{!ifc.Urgent__c}' == 'false' ? false : true;
+ //鏌ユ壘瀹㈡埛濮撳悕
+ queryContactName();
+ //瑙e瘑
+ QueryLeadFromAWSIFS();
+ unblockUI();
+ }
+ 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 (['Contact_Name__c'].indexOf(dataid) > -1)
+ 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/NewAndEditQIS.page b/force-app/main/default/pages/NewAndEditQIS.page
index 63b4410..a263915 100644
--- a/force-app/main/default/pages/NewAndEditQIS.page
+++ b/force-app/main/default/pages/NewAndEditQIS.page
@@ -170,7 +170,7 @@
let phone = document.querySelector(textPhone);
if(phone && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){
- error_msg += ';鐢佃瘽鍙风爜閿欒';
+ error_msg += ';鑱旂郴鐢佃瘽鏍煎紡閿欒';
}
for(let e of document.getElementsByTagName('select')){
@@ -430,7 +430,7 @@
// Check Required Field
let checkRequiredFieldMsgResult = checkRequiredFieldMsg(sobjJson);
if (checkRequiredFieldMsgResult) {
- alertErrorMessage('requiredErrorMsg' + checkRequiredFieldMsgResult);
+ alertErrorMessage('{!Input_Required_Field_Msg}' + checkRequiredFieldMsgResult);
return
}
// //3. Prepare the payload for New PI API To AWS - To Do
@@ -527,6 +527,17 @@
}
console.log(api_id_map);
sfdcPage.appendToOnloadQueue(function () {
+ //鍒ゆ柇鏄惁涓哄彧璇婚�夐」
+ var layoutSections = JSON.parse('{!layoutSectionsStr}');
+ for (let m = 0; m < layoutSections.length; m++) {
+ let layoutSection = layoutSections[m].layoutFields;
+ for (let n = 0; n < layoutSection.length; n++) {
+ let layoutField = layoutSection[n];
+ if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) {
+ 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
diff --git a/force-app/main/default/pages/NewAndEditRepairSubOrder.page b/force-app/main/default/pages/NewAndEditRepairSubOrder.page
index 2a393ec..15bf983 100644
--- a/force-app/main/default/pages/NewAndEditRepairSubOrder.page
+++ b/force-app/main/default/pages/NewAndEditRepairSubOrder.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="RepairSubOrder__c" extensions="NewAndEditRepairSubOrderController" id="page">
<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
<script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
@@ -72,22 +79,28 @@
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;
+ 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();
@@ -96,6 +109,10 @@
}
}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+'_','');
}
@@ -171,12 +189,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 += ';涓嬫媺妗嗕笉鑳戒富鍔ㄩ�夋嫨瀵嗘枃閫夐」';
}
@@ -215,9 +245,9 @@
v = ele.value;
}
- if(v && v != "000000000000000"){
+ // if(v && v != "000000000000000"){
result[field_api_name] = v;
- }
+ // }
}
} else if (ele.type == 'checkbox') {
@@ -320,7 +350,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
@@ -351,7 +381,9 @@
var closeField = '';
function replaceSearchContactLookup() {
- if (!{!isNewMode}) {
+ let eleContactValue = document.querySelector("[data-id='Receiver__c']").parentNode.parentNode.children[0].value;
+ let eleContactsValue = document.querySelector("[data-id='Applicanter__c']").parentNode.parentNode.children[0].value;
+ if (!{!isNewMode} || (eleContactValue != '000000000000000') || (eleContactsValue != '000000000000000')) {
//1. Query Contact from AWS by AWSDataId
queryContactName()
}
@@ -531,7 +563,7 @@
<script>
var init_nodes = document.getElementsByClassName("PIBackApi");
var api_id_map={};
- for(let e of init_nodes){
+ for(let e in init_nodes){
if(IsFormElement(e)){
api_id_map[GetEleApiName(e)] = e.id;
}
@@ -539,6 +571,16 @@
console.log(api_id_map);
sfdcPage.appendToOnloadQueue(function () {
+ var layoutSections = JSON.parse('{!layoutSectionsStr}');
+ for (let m = 0; m < layoutSections.length; m++) {
+ let layoutSection = layoutSections[m].layoutFields;
+ for (let n = 0; n < layoutSection.length; n++) {
+ let layoutField = layoutSection[n];
+ if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) {
+ 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
@@ -551,7 +593,37 @@
replaceSearchContactLookup();
//3. Set Readonly Attribute
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/NewAndEditReport.page b/force-app/main/default/pages/NewAndEditReport.page
index 7b10a4b..fe838e7 100644
--- a/force-app/main/default/pages/NewAndEditReport.page
+++ b/force-app/main/default/pages/NewAndEditReport.page
@@ -77,15 +77,12 @@
}
}
//鎵嬫湳鍒嗙被1
- result.Technical_Category1__c = document.getElementById('page:form:j_id30:j_id60:4:j_id61:j_id62:2:j_id63')!=null?document.getElementById('page:form:j_id30:j_id60:4:j_id61:j_id62:2:j_id63').value:'';
+ result.Technical_Category1__c = document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:2:j_id38')!=null?document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:2:j_id38').value:'';
//鎵嬫湳鍒嗙被2
- result.Technical_Category2__c = document.getElementById('page:form:j_id30:j_id60:4:j_id61:j_id62:4:j_id63')!=null?document.getElementById('page:form:j_id30:j_id60:4:j_id61:j_id62:4:j_id63').value:'';
+ result.Technical_Category2__c = document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:4:j_id38')!=null?document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:4:j_id38').value:'';
//鐩殑2
- if(document.getElementById('page:form:j_id30:j_id60:3:j_id61:j_id62:1:j_id63')){
- result.Purpose2__c = document.getElementById('page:form:j_id30:j_id60:3:j_id61:j_id62:1:j_id63').value;
- }
- if(document.getElementById('page:form:j_id30:j_id60:2:j_id61:j_id62:1:j_id63')){
- result.Purpose2__c = document.getElementById('page:form:j_id30:j_id60:2:j_id61:j_id62:1:j_id63').value;
+ if(document.getElementById('page:form:j_id5:j_id35:2:j_id36:j_id37:1:j_id38')){
+ result.Purpose2__c = document.getElementById('page:form:j_id5:j_id35:2:j_id36:j_id37:1:j_id38').value;
}
//瀵屾枃鏈璧嬪��
//鐢ㄦ埛绛惧瓧鐨勭収鐗�
@@ -111,6 +108,12 @@
//瀵瑰簲缁撴灉绗竴娆� VOC_follow_up_result1__c cke_71
if(document.querySelector("[aria-describedby = 'cke_71']")){
result.VOC_follow_up_result1__c = document.querySelector("[aria-describedby = 'cke_71']").contentWindow.document.getElementsByTagName('body')[0].innerHTML
+ }
+ if(result.From__c){
+ result.From__c = result.From__c.replace(/\//g, '-')+':00';
+ }
+ if(result.To__c){
+ result.To__c = result.To__c.replace(/\//g, '-')+':00';
}
return result;
}
@@ -309,55 +312,46 @@
if(document.querySelector("[data-id='Practitioner1__c']") != null){
let sfId = document.getElementById(document.querySelector("[data-id='Practitioner1__c']").id + '_lkid').value;
let dataId = contactsInfo[sfId];
- let url = staticResourcesContact.queryUrl + '?dataId=' + dataId;
- queryContactNameFetch(url,'Practitioner1__c');
+ let url = staticResourcesContact.queryUrl;
+ queryContactNameFetch(url,dataId,'Practitioner1__c');
}
if(document.querySelector("[data-id='Practitioner2__c']") != null){
let sfId = document.getElementById(document.querySelector("[data-id='Practitioner2__c']").id + '_lkid').value;
let dataId = contactsInfo[sfId];
- let url = staticResourcesContact.queryUrl + '?dataId=' + dataId;
- queryContactNameFetch(url,'Practitioner2__c');
+ let url = staticResourcesContact.queryUrl;
+ queryContactNameFetch(url,dataId,'Practitioner2__c');
}
if(document.querySelector("[data-id='Practitioner3__c']") != null){
let sfId = document.getElementById(document.querySelector("[data-id='Practitioner3__c']").id + '_lkid').value;
let dataId = contactsInfo[sfId];
- let url = staticResourcesContact.queryUrl + '?dataId=' + dataId;
- queryContactNameFetch(url,'Practitioner3__c');
+ let url = staticResourcesContact.queryUrl;
+ queryContactNameFetch(url,dataId,'Practitioner3__c');
}
if(document.querySelector("[data-id='Practitioner4__c']") != null){
let sfId = document.getElementById(document.querySelector("[data-id='Practitioner4__c']").id + '_lkid').value;
let dataId = contactsInfo[sfId];
- let url = staticResourcesContact.queryUrl + '?dataId=' + dataId;
- queryContactNameFetch(url,'Practitioner4__c');
+ let url = staticResourcesContact.queryUrl;
+ queryContactNameFetch(url,dataId,'Practitioner4__c');
}
if(document.querySelector("[data-id='Practitioner5__c']") != null){
let sfId = document.getElementById(document.querySelector("[data-id='Practitioner5__c']").id + '_lkid').value;
let dataId = contactsInfo[sfId];
- let url = staticResourcesContact.queryUrl + '?dataId=' + dataId;
- queryContactNameFetch(url,'Practitioner5__c');
+ let url = staticResourcesContact.queryUrl;
+ queryContactNameFetch(url,dataId,'Practitioner5__c');
}
if(document.querySelector("[data-id='Person_In_Charge__c']") != null){
let sfId = document.getElementById(document.querySelector("[data-id='Person_In_Charge__c']").id + '_lkid').value;
let dataId = contactsInfo[sfId];
- let url = staticResourcesContact.queryUrl + '?dataId=' + dataId;
- queryContactNameFetch(url,'Person_In_Charge__c');
+ let url = staticResourcesContact.queryUrl;
+ queryContactNameFetch(url,dataId,'Person_In_Charge__c');
}
}
- function queryContactNameFetch(url,filedId){
- fetch(url, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- 'pi-token': staticResources.token
- }
- }).then((data) => {
- return data.json();
- }).then((result) => {
- if(result.object){
- document.querySelector("[data-id="+filedId+"]").value = result.object.lastName;
- }
- })
+ function queryContactNameFetch(url,dataId,filedId){
+ let queryBackContactNameFetch = function queryBackContactNameFetch(result){
+ document.querySelector("[data-id="+filedId+"]").value = result.object.lastName;
+ };
+ AWSService.query(url, dataId, queryBackContactNameFetch, staticResources.token);
}
//鑷畾涔塴ookup鏌ヨ
@@ -405,6 +399,11 @@
//鏂板缓缂栬緫鍥炶皟鍑芥暟
var insertOrUpdateBack = function insertOrUpdateBack(payloadJson, result, isNewMode) {
console.log(result);
+ if(result.status != '0'){
+ unblockUI();
+ console.log('鍥炶皟鍑芥暟鍑洪敊鎷�')
+ return
+ }
console.log('Result from AWS' + result);
console.log('payloadJson=' + payloadJson);
payloadJson.VOC_Informer_Name__c = result.object[0].vocInformerName;
@@ -476,7 +475,7 @@
// 3. Check Required Field
let checkRequiredFieldMsgResult = checkRequiredFieldMsg(reportJson);
if (checkRequiredFieldMsgResult) {
- alertErrorMessage('{!requiredErrorMsg}'+checkRequiredFieldMsgResult);
+ alertErrorMessage('{!Input_Required_Field_Msg}'+checkRequiredFieldMsgResult);
return
}
//4. Prepare the payload for New PI API To AWS - To Do
@@ -556,6 +555,18 @@
</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
@@ -567,6 +578,35 @@
replaceSearchContactLookup();
//3. Set Readonly Attribute
document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
+ 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 (['Practitioner1__c','Practitioner2__c','Practitioner3__c','Practitioner4__c','Practitioner5__c','Person_In_Charge__c'].indexOf(dataid) > -1)
+ 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/SearchAWSContactByNamePage.page b/force-app/main/default/pages/SearchAWSContactByNamePage.page
new file mode 100644
index 0000000..8f311fd
--- /dev/null
+++ b/force-app/main/default/pages/SearchAWSContactByNamePage.page
@@ -0,0 +1,197 @@
+<apex:page controller="SearchContactController" id="page">
+ <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
+
+ <head>
+ </head>
+ <style>
+ /* 1. 瀹氫箟琛ㄥ崟鏍峰紡 To Do Later*/
+
+ table {
+ border-collapse: collapse;
+ border-spacing: 0;
+ width: 98%;
+ margin-left: 5px;
+ }
+ </style>
+
+ <body id="body" class="lookupTab">
+ <script type="text/javascript">
+ var staticResources = JSON.parse('{!staticResource}');
+ var contactAWSIds = JSON.parse('{!contactAWSIds}');
+ var contactsInfo = JSON.parse('{!contactsInfo}');
+ var searchContactName = '';
+ function searchAWSContact(){
+ console.log('Search process!');
+ //1. reset table;
+ resetTable();
+ //2. get contact name value
+ searchContactName = document.getElementById('page:form:lksrch').value;
+ //3. check searchContactName.length>=2
+ if(searchContactName.length>=2){
+ queryLeadFromAWS();
+ }else{
+ alert("璇疯緭鍏ヨ嚦灏�2涓叧閿瓧");
+ }
+
+ }
+ function resetTable(){
+ let queryResult = document.getElementById('QueryResult');
+ let table = document.getElementById('table');
+ if(table){
+ queryResult.removeChild(table);
+ }
+ }
+ function preparePayloadForSearchContact(){
+ let searchPayload = new Object();
+ searchPayload.dataIds = [];
+ searchPayload.contactName = searchContactName;
+ return JSON.stringify(searchPayload);
+ }
+ function queryLeadFromAWS() {
+ //1. Prepare the payload for contact search
+ let requestSearchPayload = preparePayloadForSearchContact();
+ console.log('request payload body:'+requestSearchPayload);
+ //2. Invoke AWS Service
+ fetch(staticResources.searchUrl, {
+ method: 'POST',
+ body: requestSearchPayload,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': staticResources.token
+ }
+ }).then((data) => {
+ return data.json();
+ }).then((result) => {
+ console.log('JSON Result from aws:'+JSON.stringify(result));
+ if(result.object&&result.object.length>0){
+ initContactTable(result);
+ }
+ })
+ }
+
+ function redirectToParentPage(obj) {
+ var winMain = window.opener;
+ if (null == winMain) {
+ winMain = window.parent.opener;
+ }
+ let value = obj.currentTarget.innerText;
+ let contactInfo = new Object();
+ contactInfo.Name = obj.currentTarget.innerText;
+ contactInfo.ContactId = obj.currentTarget.id;
+ window.open('\\'+obj.currentTarget.id,'_blank');
+ console.log('Contact Infor:'+JSON.stringify(contactInfo));
+ }
+
+ function refreshTable(cols,contactInfoList){
+ let myTableDiv = document.getElementById("QueryResult");
+ let table = document.createElement('TABLE');
+ table.border = '1';
+ table.id = 'table'
+ let tableBody = document.createElement('TBODY');
+ table.appendChild(tableBody);
+ let headerTR = document.createElement('TR');
+ let colsHeader = ['濮撳悕','瀹㈡埛鍚嶇О','閭', '鐢佃瘽'];
+ tableBody.appendChild(headerTR);
+ for (let i = 0; i < colsHeader.length; i++) {
+ let td = document.createElement('TH');
+ td.width = '75';
+ td.appendChild(document.createTextNode(colsHeader[i]));
+ headerTR.appendChild(td);
+ }
+ //3. Init the AWS data
+ for (let i = 0; i < contactInfoList.length; i++) {
+ let contactInfoTemp = contactInfoList[i]
+ if(contactsInfo[contactInfoTemp.AWSDataId] != null){
+ let tr = document.createElement('TR');
+ tableBody.appendChild(tr);
+ for (let j = 0; j < cols.length; j++) {
+ let td = document.createElement('TD');
+ td.width = '75';
+ if(j == 0){
+ td.id = contactsInfo[contactInfoTemp.AWSDataId].Id;
+ }
+ td.appendChild(document.createTextNode(contactInfoTemp[cols[j]]!=null?contactInfoTemp[cols[j]]:''));
+ if (cols[j] == 'Name') {
+ td.addEventListener("click", function (obj) {
+ redirectToParentPage(obj);
+ });
+ }
+ tr.appendChild(td);
+ }
+ }
+ }
+ myTableDiv.appendChild(table);
+ }
+ function initContactTable(data) {
+ let cols = ['Name','AccountName','Email', 'Phone'];
+ let contactInfoList = [];
+ let awsDataIds = [];
+ for(var i=0;i<data.object.length;i++){
+ if(data.object[i].dataId){
+ let contactInfo = new Object();
+ contactInfo.Name = data.object[i].lastName;
+ contactInfo.Email = data.object[i].email;
+ contactInfo.Phone = data.object[i].phone;
+ contactInfo.AWSDataId = data.object[i].dataId;
+ awsDataIds.push(contactInfo.AWSDataId);
+ contactInfo.sfRecordId = '';
+ contactInfoList.push(contactInfo);
+ }
+ }
+ let AWSIdToSFIdMapValue = {};
+ console.log('Contact Info from AWS:'+JSON.stringify(contactInfoList));
+ //Invoke SF BackEnd
+ Visualforce.remoting.Manager.invokeAction(
+ '{!$RemoteAction.SearchContactController.searchContacts}',
+ JSON.stringify(awsDataIds),
+ function (result, event) {
+ if(event.status){
+ if(result.status == 'success'){
+ contactsInfo = JSON.parse(result.message.replace(/("\;)/g,"\""));
+ console.log('Contact Info from SF:'+JSON.stringify(contactsInfo));
+ if(Object.keys(contactsInfo).length>0){
+ for(let i=0;i<contactInfoList.length;i++){
+ let contactFromSF = contactsInfo[contactInfoList[i]['AWSDataId']];
+ if(contactFromSF){
+ contactInfoList[i].sfRecordId = contactFromSF['Id'];
+ contactInfoList[i].AccountName = contactFromSF['Account']['Name'];
+ }
+ }
+ }
+
+ refreshTable(cols,contactInfoList);
+ }else{
+ alert('娌℃煡璇㈠埌璇ヨ仈绯讳汉');
+ console.log('No result');
+ refreshTable(cols,[]);
+ }
+ }
+ },
+ { escape: true }
+ );
+ }
+ </script>
+ <apex:form id="form">
+ <!-- Search Filter-->
+ <div class="lookup">
+ <div class="bPageTitle">
+ <div class="ptBody secondaryPalette">
+ <div class="content">
+ <img src="/img/s.gif" alt="" class="pageTitleIcon" title="" />
+ <h1>鑱旂郴浜烘悳绱�</h1>
+ </div>
+ </div>
+ </div>
+ <div class="pBody">
+ <label class="assistiveText" for="lksrch">Search</label>
+ <apex:inputText id="lksrch" html-placeholder="{!PIPL_Search_Contact_Label}" value="{!searchKeyWord}" />
+ <input value=" Go! " type="Button" onclick="searchAWSContact()" styleClass="btn" />
+ <div class="bDescription">璇疯緭鍏ヨ仈绯讳汉鐨勫鍚嶈繘琛屾悳绱€��
+ </div>
+ </div>
+ </div>
+ <div id="QueryResult">
+ </div>
+ </apex:form>
+ </body>
+</apex:page>
\ No newline at end of file
diff --git a/force-app/main/default/pages/SearchAWSContactByNamePage.page-meta.xml b/force-app/main/default/pages/SearchAWSContactByNamePage.page-meta.xml
new file mode 100644
index 0000000..e9d2d29
--- /dev/null
+++ b/force-app/main/default/pages/SearchAWSContactByNamePage.page-meta.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>52.0</apiVersion>
+ <availableInTouch>false</availableInTouch>
+ <confirmationTokenRequired>false</confirmationTokenRequired>
+ <label>SearchAWSContactByNamePage</label>
+</ApexPage>
diff --git a/force-app/main/default/pages/SearchContactPage.page b/force-app/main/default/pages/SearchContactPage.page
index b88431b..67cb3b9 100644
--- a/force-app/main/default/pages/SearchContactPage.page
+++ b/force-app/main/default/pages/SearchContactPage.page
@@ -109,6 +109,9 @@
for (let j = 0; j < cols.length; j++) {
let td = document.createElement('TD');
td.width = '75';
+ if (!contactsInfo.hasOwnProperty(contactInfoTemp.AWSDataId)) {
+ continue;
+ }
if(j == 0){
td.id = contactsInfo[contactInfoTemp.AWSDataId].Id;
}
diff --git a/force-app/main/default/pages/SearchVisitor.page b/force-app/main/default/pages/SearchVisitor.page
index 09049f0..4544db5 100644
--- a/force-app/main/default/pages/SearchVisitor.page
+++ b/force-app/main/default/pages/SearchVisitor.page
@@ -285,6 +285,7 @@
function Trans(){
AWSService.postAWS(staticResources.transactionUrl,AWSService.confirmTrans, JSON.stringify({
"txId":aws_result.txId,
+ "sfRecordId":"",
"isSuccess":1
}), function(result){
window.location.reload();
diff --git a/force-app/main/default/pages/StraightBackAddress.page b/force-app/main/default/pages/StraightBackAddress.page
index e62de6b..9dca379 100644
--- a/force-app/main/default/pages/StraightBackAddress.page
+++ b/force-app/main/default/pages/StraightBackAddress.page
@@ -379,6 +379,7 @@
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++){
@@ -441,7 +442,7 @@
'\n閭紪: '+PIData[awsDataId].zipCode+
'\n璇︾粏鍦板潃: '+PIData[awsDataId].detailedAddress
}else{
- piInformation = '鑱旂郴浜�: null'+
+ piInformation = '鑱旂郴浜�: '+
'\n鐢佃瘽: '+PIData[awsDataId].telephone+
'\n閭紪: '+PIData[awsDataId].zipCode+
'\n璇︾粏鍦板潃: '+PIData[awsDataId].detailedAddress
@@ -452,9 +453,12 @@
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){
@@ -631,9 +635,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}" 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>
+ <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>
</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 431ef8e..cc9e50b 100644
--- a/force-app/main/default/pages/UploadPdf.page
+++ b/force-app/main/default/pages/UploadPdf.page
@@ -1,6 +1,7 @@
<!-- 璇ラ〉闈㈢敤浜嶭ead瀵硅薄涓婁紶PDF锛屾湭鏉ュ鏋滆娣诲姞鍏朵粬瀵硅薄鐨勪笂浼燩DF鍔熻兘锛屽鍒惰椤甸潰锛屽皢**standardController**淇敼涓哄叾浠栧璞PI鍚嶇О鍗冲彲 -->
<apex:page standardController="Lead" extensions="FileUploadController" id="page" lightningStyleSheets="true">
<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
+ <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<script>
var staticResources = JSON.parse('{!staticResource}');
var parentId = '{!parentId}';
@@ -29,8 +30,8 @@
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
- reader.onload = () => resolve(reader.result);
- reader.onerror = error => reject(error);
+ reader.onload = function(){resolve(reader.result)} ;
+ reader.onerror =function(error){reject(error)};
});
}
function disableButtonStatus() {
@@ -47,7 +48,7 @@
disableButtonStatus();
var fileObject = document.getElementById("file").files[0];
getBase64(fileObject).then(
- data => {
+ function(data) {
console.log(data);
uploadFileToAWS(data, (fileObject.size).toString(), fileObject.name);
@@ -56,23 +57,31 @@
}
function confirmTrans(transId, isSuccess) {
- fetch(staticResources.updateUrl, {
- method: 'POST',
- body: JSON.stringify({ 'txId': transId, "isSuccess": isSuccess }),
- headers: {
- 'Content-Type': 'application/json',
- 'pi-token': staticResources.token
- }
- }).then((data) => {
- return data.json();
- }).then(data => {
- console.log("confirmTrans-" + JSON.stringify(data));
- document.getElementById("file").files[0].name = '';
- enableButtonStatus();
- refreshFiles();
- return data.status;
- })
-
+ // fetch(staticResources.updateUrl, {
+ // method: 'POST',
+ // body: JSON.stringify({ 'txId': transId, "isSuccess": isSuccess }),
+ // headers: {
+ // 'Content-Type': 'application/json',
+ // 'pi-token': staticResources.token
+ // }
+ // }).then(function(data) {
+ // return data.json();
+ // }).then(function(data) {
+ // console.log("confirmTrans-" + JSON.stringify(data));
+ // document.getElementById("file").files[0].name = '';
+ // enableButtonStatus();
+ // refreshFiles();
+ // return data.status;
+ // })
+
+ AWSService.post(staticResources.updateUrl, JSON.stringify({
+ "txId":transId,
+ "sfRecordId":"",
+ "isSuccess":isSuccess
+ }), function(result){
+ window.location.reload();
+ }, staticResources.token);
+
}
function calculateFileSize(fileObject) {
if (fileObject.size > 20971520) {
@@ -81,21 +90,14 @@
}
function uploadFileToAWS(data, size, fileName) {
console.log("body=" + JSON.stringify({ 'file': data, "size": size, 'fileName': fileName }));
-
- fetch(uploadUrl, {
- method: 'POST',
- body: JSON.stringify({ 'file': data, "size": size, 'fileName': fileName }),
- headers: {
- 'Content-Type': 'application/json',
- 'pi-token': staticResources.token
- }
- }).then((data) => {
- return data.json();
- }).then(result => {
+ AWSService.post(uploadUrl, JSON.stringify({
+ 'file': data,
+ "size": size,
+ 'fileName': fileName })
+ , function(result){
+ console.log("result" + JSON.stringify(result));
- console.log("result" + JSON.stringify(result));
-
- if (result.success == true) {
+ if (result.success == true) {
key = result.object;
Visualforce.remoting.Manager.invokeAction(
@@ -124,11 +126,56 @@
} else {
alertErrorMessage('涓婁紶澶辫触璇风◢鍚庡啀璇曪紒');
}
- }).catch((error) => {
- console.error('Error:', error);
- })
- debugger
+ }, staticResources.token);
+
}
+ // fetch(uploadUrl, {
+ // method: 'POST',
+ // body: JSON.stringify({ 'file': data, "size": size, 'fileName': fileName }),
+ // headers: {
+ // 'Content-Type': 'application/json',
+ // 'pi-token': staticResources.token
+ // }
+ // }).then(function(data) {
+ // return data.json();
+ // }).then(function(result) {
+
+ // console.log("result" + JSON.stringify(result));
+
+ // if (result.success == true) {
+ // key = result.object;
+
+ // Visualforce.remoting.Manager.invokeAction(
+ // '{!$RemoteAction.FileUploadController.saveFile}',
+ // fileName, key, result.txId, parentId,
+ // function (resultvalue, event) {
+
+
+
+ // //2. show file list
+ // if (resultvalue.status == 'fail') {
+ // alertErrorMessage(resultvalue.message);
+ // //1. Confirm trans
+ // confirmTrans(result.txId, 0);
+ // } else {
+ // alertErrorMessage('涓婁紶鎴愬姛');
+ // confirmTrans(result.txId, 1);
+ // }
+
+ // // window.location.reload();
+ // },
+ // { escape: true }
+ // );
+
+ // console.log('key' + key);
+ // } else {
+ // alertErrorMessage('涓婁紶澶辫触璇风◢鍚庡啀璇曪紒');
+ // }
+ // }).catch(function(error) {
+ // console.error('Error:', error);
+ // })
+ // debugger
+ // }
function downPdf(fileUrl) {
window.open(fileUrl,'_blank');
}
diff --git a/force-app/main/default/pages/ViewAgencyContactDecryptInfo.page b/force-app/main/default/pages/ViewAgencyContactDecryptInfo.page
index 2584e36..9e9746b 100644
--- a/force-app/main/default/pages/ViewAgencyContactDecryptInfo.page
+++ b/force-app/main/default/pages/ViewAgencyContactDecryptInfo.page
@@ -1,4 +1,5 @@
<apex:page standardController="Agency_Contact__c" extensions="NewAndEditAgencyContactController" id="page">
+ <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/>
<apex:form id="form">
<apex:pageblock id="pageBlock">
diff --git a/force-app/main/default/pages/ViewContactDecryptInfo.page b/force-app/main/default/pages/ViewContactDecryptInfo.page
index 5ac4ce9..56a269f 100644
--- a/force-app/main/default/pages/ViewContactDecryptInfo.page
+++ b/force-app/main/default/pages/ViewContactDecryptInfo.page
@@ -1,5 +1,6 @@
<apex:page standardController="Contact" extensions="NewAndEditContactController" id="page">
- <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/>
+ <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
+ <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
<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/ViewLeadDecryptInfo.page b/force-app/main/default/pages/ViewLeadDecryptInfo.page
index 21ae11c..0cf2bd6 100644
--- a/force-app/main/default/pages/ViewLeadDecryptInfo.page
+++ b/force-app/main/default/pages/ViewLeadDecryptInfo.page
@@ -1,4 +1,5 @@
<apex:page standardController="Lead" extensions="NewAndEditLeadController" id="page">
+ <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/>
<script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
<apex:form id="form">
@@ -17,7 +18,7 @@
}
var queryBack = function queryBack(data) {
document.querySelector("[data-id='LastName']").innerHTML = data.object.lastName;
- document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id2:0:j_id3']").innerHTML = data.object.phone;
+ document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id3:0:j_id4']").innerHTML = data.object.phone;
document.querySelector("[data-id='Email']").innerHTML = data.object.email;
};
diff --git a/force-app/main/default/pages/ViewQISReportDecryptInfo.page b/force-app/main/default/pages/ViewQISReportDecryptInfo.page
index f3c197d..2cf384a 100644
--- a/force-app/main/default/pages/ViewQISReportDecryptInfo.page
+++ b/force-app/main/default/pages/ViewQISReportDecryptInfo.page
@@ -1,4 +1,5 @@
<apex:page standardController="QIS_Report__c" extensions="NewAndEditQISController" id="page">
+ <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/>
<apex:form id="form">
<apex:pageblock id="pageBlock">
diff --git a/force-app/main/default/pages/ViewReportDecryptInfo.page b/force-app/main/default/pages/ViewReportDecryptInfo.page
index fbcaf7a..1c21e0f 100644
--- a/force-app/main/default/pages/ViewReportDecryptInfo.page
+++ b/force-app/main/default/pages/ViewReportDecryptInfo.page
@@ -1,4 +1,5 @@
<apex:page standardController="Report__c" extensions="NewAndEditReportController" id="page">
+ <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/>
<apex:form id="form">
<apex:pageblock id="pageBlock">
@@ -15,7 +16,7 @@
}
var queryBack = function queryBack(data) {
document.querySelector("[data-id='VOC_Informer_Name__c']").innerHTML=data.object.vocInformerName!=null?data.object.vocInformerName.replace(/"/g,""):'';
- document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id1:1:j_id2']").innerHTML=data.object.callerPhone!=null?data.object.callerPhone.replace(/"/g,""):'';
+ document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id2:1:j_id3']").innerHTML=data.object.callerPhone!=null?data.object.callerPhone.replace(/"/g,""):'';
document.querySelector("[data-id='VOC_Informer_Contact__c']").innerHTML=data.object.vocInformerContact!=null?data.object.vocInformerContact.replace(/"/g,""):'';
document.querySelector("[data-id='Person_In_Charge_Text__c']").innerHTML=data.object.personInChargeText!=null?data.object.personInChargeText.replace(/"/g,""):'';
document.querySelector("[data-id='Professor_sigh_text__c']").innerHTML=data.object.professorSighText!=null?data.object.professorSighText.replace(/"/g,""):'';
diff --git a/force-app/main/default/staticresources/AWSService.resource-meta.xml b/force-app/main/default/staticresources/AWSService.resource-meta.xml
new file mode 100644
index 0000000..78e2716
--- /dev/null
+++ b/force-app/main/default/staticresources/AWSService.resource-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<StaticResource xmlns="http://soap.sforce.com/2006/04/metadata">
+ <cacheControl>Public</cacheControl>
+ <contentType>application/zip</contentType>
+</StaticResource>
diff --git a/force-app/main/default/staticresources/AWSService/AWSService.js b/force-app/main/default/staticresources/AWSService/AWSService.js
new file mode 100644
index 0000000..b5e38ca
--- /dev/null
+++ b/force-app/main/default/staticresources/AWSService/AWSService.js
@@ -0,0 +1,384 @@
+var AWSService = {};
+AWSService = {
+ sfSessionId : '',
+ insertModule : 'Insert AWS ',
+ updateModule : 'Update AWS ',
+ queryModule : 'Query AWS ',
+ searchModule : 'Search AWS ',
+ confirmTrans : 'Confirm Transaction To AWS',
+ successStatus : 'success',
+ failStatus : 'fail',
+ insertCalloutLog:function(module,url,request,response,status){
+ if(AWSService.sfSessionId){
+ sforce.connection.sessionId = AWSService.sfSessionId;
+ let transLog = new sforce.SObject('Transaction_Log__c');
+ transLog.AWS_Data_Id__c = '';
+ transLog.Module__c = module;
+ transLog.Interface_URL__c = url;
+ transLog.Request__c = request;
+ transLog.Response__c = response;
+ transLog.Status__c = status;
+ let insertLogResult = sforce.connection.create([transLog]);
+ if(insertLogResult[0].getBoolean(AWSService.successStatus)) {
+ console.log('Insert Log Id: ' + insertLogResult[0].id);
+ return insertLogResult[0].id;
+ }else {
+ console.log('Faield to insert log');
+ return '';
+ }
+ }
+ },
+ //Search Contact
+ search:function(searchUrl,requestSearchPayload,searchBack,token) {
+ let payloadstr= null;
+ if (requestSearchPayload) {
+ if (typeof requestSearchPayload == 'string') {
+ payloadstr = requestSearchPayload;
+ }else{
+ payloadstr = JSON.stringify(requestSearchPayload);
+ }
+ }
+ let para = {
+ url:searchUrl,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ },
+ type: "post",
+ success: function (result) {
+ AWSService.insertCalloutLog(AWSService.searchModule,searchUrl,JSON.stringify(requestSearchPayload),JSON.stringify(result),AWSService.successStatus);
+ searchBack(result);
+ },
+ error: function (error){
+ //閿欒鐩稿叧澶勭悊 404灞炰簬璇ュ鐞嗭紙缁忔祴璇曪級
+ //杩樺彲鑳芥槸"timeout", "error", "notmodified" 鍜� "parsererror"銆�
+ AWSService.insertCalloutLog(AWSService.searchModule,searchUrl,JSON.stringify(requestSearchPayload),JSON.stringify(error),AWSService.failStatus);
+ console.log('閿欒澶勭悊',error);
+ }
+ };
+ if (payloadstr) {
+ para.data = payloadstr;
+ }
+ jQuery.ajax(para);
+
+ },
+
+ //query
+ query:function(queryURL, awsDataId, queryback, token) {
+ if(awsDataId){
+ let para = {
+ url:queryURL + '?dataId=' + awsDataId,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ },
+ type: "get",
+ success: function (data) {
+ AWSService.insertCalloutLog(AWSService.queryModule,queryURL,queryURL + '?dataId=' + awsDataId,JSON.stringify(data),AWSService.successStatus);
+ queryback(data);
+ },
+ error: function (error){
+ //閿欒鐩稿叧澶勭悊 404灞炰簬璇ュ鐞嗭紙缁忔祴璇曪級
+ //杩樺彲鑳芥槸"timeout", "error", "notmodified" 鍜� "parsererror"銆�
+ AWSService.insertCalloutLog(AWSService.queryModule,queryURL,queryURL + '?dataId=' + awsDataId,JSON.stringify(error),AWSService.failStatus);
+ console.log(error);
+ }
+ };
+ jQuery.ajax(para);}else{
+ unblockUI();
+ }
+ },
+
+ //queryRepair
+ queryRepair:function(queryURL, awsDataId,Id,ContactId,queryback, token) {
+ if(awsDataId){
+ let para = {
+ url:queryURL + '?dataId=' + awsDataId,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ },
+ type: "get",
+ success: function (data) {
+ AWSService.insertCalloutLog(AWSService.queryModule,queryURL,queryURL + '?dataId=' + awsDataId,JSON.stringify(data),AWSService.successStatus);
+ queryback(data,Id,ContactId);
+ },
+ error: function (error){
+ //閿欒鐩稿叧澶勭悊 404灞炰簬璇ュ鐞嗭紙缁忔祴璇曪級
+ //杩樺彲鑳芥槸"timeout", "error", "notmodified" 鍜� "parsererror"銆�
+ AWSService.insertCalloutLog(AWSService.queryModule,queryURL,queryURL + '?dataId=' + awsDataId,JSON.stringify(error),AWSService.failStatus);
+ console.log(error);
+ }
+ };
+ jQuery.ajax(para);}else{
+ unblockUI();
+ }
+
+ },
+
+ //queryAddress
+ queryAddress:function(queryURL, addressName, queryback, token) {
+ if(addressName){
+ let para = {
+ url:queryURL + '?detailedAddress=' + addressName,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ },
+ type: "get",
+ success: function (data) {
+ AWSService.insertCalloutLog(AWSService.queryModule,queryURL,queryURL + '?detailedAddress=' + awsDataId,JSON.stringify(data),AWSService.successStatus);
+ queryback(data);
+ },
+ error: function (error){
+ //閿欒鐩稿叧澶勭悊 404灞炰簬璇ュ鐞嗭紙缁忔祴璇曪級
+ //杩樺彲鑳芥槸"timeout", "error", "notmodified" 鍜� "parsererror"銆�
+ AWSService.insertCalloutLog(AWSService.queryModule,queryURL,queryURL + '?detailedAddress=' + awsDataId,JSON.stringify(error),AWSService.failStatus);
+ console.log(error);
+ }
+ };
+ jQuery.ajax(para);}else{
+ unblockUI();
+ }
+
+ },
+
+ //insert
+ insert:function(newURL, payloadJson, payloadForNewPI, controllerSaveMethod, token, transactionURL,isNewMode,insertOrUpdateBack,redirectCallBack) {
+ console.log('Process New PI Data');
+ console.log(JSON.stringify(payloadForNewPI));
+
+
+ let payloadstr= null;
+ if (payloadForNewPI) {
+ if (typeof payloadForNewPI == 'string') {
+ payloadstr = payloadForNewPI;
+ }else{
+ payloadstr = JSON.stringify(payloadForNewPI);
+ }
+ }
+ let para = {
+ url:newURL,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ },
+ type: "post",
+ success: function (result) {
+ AWSService.insertCalloutLog(AWSService.insertModule,newURL,JSON.stringify(payloadForNewPI),JSON.stringify(result),AWSService.successStatus);
+ AWSService.back(result, payloadJson, transactionURL, token, controllerSaveMethod,isNewMode,insertOrUpdateBack,redirectCallBack);
+ },
+ error: function (error){
+ //閿欒鐩稿叧澶勭悊 404灞炰簬璇ュ鐞嗭紙缁忔祴璇曪級
+ //杩樺彲鑳芥槸"timeout", "error", "notmodified" 鍜� "parsererror"銆�
+ AWSService.insertCalloutLog(AWSService.insertModule,newURL,JSON.stringify(payloadForNewPI),JSON.stringify(error),AWSService.failStatus);
+ console.log(error);
+ }
+ };
+ if (payloadstr) {
+ para.data = payloadstr;
+ }
+ jQuery.ajax(para);
+
+
+ },
+
+ //update
+ update:function(updateURL, payloadJson, payloadForNewPI, controllerSaveMethod, token, transactionURL,isNewMode,insertOrUpdateBack,redirectCallBack) {
+ console.log('Process New PI Data');
+ console.log(JSON.stringify(payloadForNewPI));
+ if(payloadForNewPI && JSON.parse(payloadForNewPI)[0] && JSON.parse(payloadForNewPI)[0]['dataId']){
+ let payloadstr= null;
+ if (payloadForNewPI) {
+ if (typeof payloadForNewPI == 'string') {
+ payloadstr = payloadForNewPI;
+ }else{
+ payloadstr = JSON.stringify(payloadForNewPI);
+ }
+ }
+ let para = {
+ url:updateURL,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ },
+ type: "post",
+ success: function (result) {
+ AWSService.insertCalloutLog(AWSService.updateModule,updateURL,JSON.stringify(payloadForNewPI),JSON.stringify(result),AWSService.successStatus);
+ AWSService.back(result, payloadJson, transactionURL, token, controllerSaveMethod,isNewMode,insertOrUpdateBack,redirectCallBack);
+ },
+ error: function (error){
+ //閿欒鐩稿叧澶勭悊 404灞炰簬璇ュ鐞嗭紙缁忔祴璇曪級
+ //杩樺彲鑳芥槸"timeout", "error", "notmodified" 鍜� "parsererror"銆�
+ AWSService.insertCalloutLog(AWSService.updateModule,updateURL,JSON.stringify(payloadForNewPI),JSON.stringify(error),AWSService.failStatus);
+ console.log(error);
+ }
+ };
+ if (payloadstr) {
+ para.data = payloadstr;
+ }
+ jQuery.ajax(para);
+ }else{
+ unblockUI();
+ }
+
+ },
+
+ //update
+ post:function(postURL, payloadForNewPI, callback, token) {
+ console.log('Process New PI Data');
+ console.log(JSON.stringify(payloadForNewPI));
+
+ let payloadstr= null;
+ if (payloadForNewPI) {
+ if (typeof payloadForNewPI == 'string') {
+ payloadstr = payloadForNewPI;
+ }else{
+ payloadstr = JSON.stringify(payloadForNewPI);
+ }
+ }
+ let para = {
+ url:postURL,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ },
+ type: "post",
+ success: function (result) {
+ AWSService.insertCalloutLog(AWSService.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(result),AWSService.successStatus);
+ if(callback) callback(result);
+ },
+ error: function (error){
+ AWSService.insertCalloutLog(AWSService.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(error),AWSService.failStatus);
+ console.log(error);
+ }
+ };
+ if (payloadstr) {
+ para.data = payloadstr;
+ }
+ jQuery.ajax(para);
+
+ },
+
+ //update
+ postAWS:function(postURL,moduleName,payloadForNewPI, callback, token) {
+ console.log('Process New PI Data');
+ console.log(JSON.stringify(payloadForNewPI));
+
+ let payloadstr= null;
+ if (payloadForNewPI) {
+ if (typeof payloadForNewPI == 'string') {
+ payloadstr = payloadForNewPI;
+ }else{
+ payloadstr = JSON.stringify(payloadForNewPI);
+ }
+ }
+ let para = {
+ url:postURL,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ },
+ type: "post",
+ success: function (result) {
+ AWSService.insertCalloutLog(moduleName,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(result),AWSService.successStatus);
+ if(callback)callback(result);
+ },
+ error: function (error){
+ AWSService.insertCalloutLog(moduleName,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(error),AWSService.failStatus);
+ console.log(error);
+ }
+ };
+ if (payloadstr) {
+ para.data = payloadstr;
+ }
+ jQuery.ajax(para);
+
+ },
+
+ confirmTrans:function(transactionURL,transParameters,callback,token){
+
+ let payloadstr= null;
+ if (transParameters) {
+ if (typeof transParameters == 'string') {
+ payloadstr = transParameters;
+ }else{
+ payloadstr = JSON.stringify(transParameters);
+ }
+ }
+ let para = {
+ url:transactionURL,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ },
+ type: "post",
+ success: function (result) {
+ AWSService.insertCalloutLog(AWSService.confirmTrans,transactionURL,JSON.stringify(transParameters),JSON.stringify(result),AWSService.successStatus);
+ if(callback)callback(result);
+ },
+ error: function (error){
+ AWSService.insertCalloutLog(AWSService.confirmTrans,transactionURL,JSON.stringify(transParameters),JSON.stringify(error),AWSService.failStatus);
+ console.log(error);
+ }
+ };
+
+ if (payloadstr) {
+ para.data = payloadstr;
+ }
+ jQuery.ajax(para);
+
+ },
+
+ sfdcBack : function(event, result, transId, token, transactionURL,redirectCallBack) {
+ let sfId = '';
+ let errorMsg = '';
+ if (event.status) {
+ console.log('sf Id from SF Backend:' + JSON.stringify(result));
+ let transParameters = {
+ txId: transId
+ };
+ if (result.status == 'success') {
+ transParameters.isSuccess = 1;
+ transParameters.sfRecordId = sfId = result.recordId;;
+ }else{
+ transParameters.isSuccess = 0;
+ errorMsg = result.message;
+ }
+
+ let para = {
+ url:transactionURL,
+ headers: {
+ 'Content-Type': 'application/json',
+ 'pi-token': token
+ },
+ data:JSON.stringify(transParameters),
+ type: "post",
+ success: function (result) {
+ AWSService.insertCalloutLog(AWSService.confirmTrans,transactionURL,JSON.stringify(transParameters),JSON.stringify(result),AWSService.successStatus);
+ redirectCallBack(sfId,errorMsg);
+ },
+ error: function (error){
+ AWSService.insertCalloutLog(AWSService.confirmTrans,transactionURL,JSON.stringify(transParameters),JSON.stringify(error),AWSService.failStatus);
+ console.log(error);
+ }
+ };
+
+ jQuery.ajax(para);
+ }
+ },
+
+ // AWSService.back(result, payloadJson, transactionURL, token, controllerSaveMethod);
+ back : function(result, payloadJson, transactionURL, token, controllerSaveMethod,isNewMode,insertOrUpdateBack,redirectCallBack) {
+ let payloadJsonStr = JSON.stringify(insertOrUpdateBack(payloadJson, result,isNewMode));
+ let transId = result.txId + '';
+ Visualforce.remoting.Manager.invokeAction(
+ controllerSaveMethod, // example '{!$RemoteAction.NewAndEditLeadController.saveLead}'
+ payloadJsonStr, transId, isNewMode,
+ function (result, event) {
+ AWSService.sfdcBack(event, result, transId, token, transactionURL,redirectCallBack);
+ },
+ { escape: true }
+ );
+ }
+};
\ No newline at end of file
--
Gitblit v1.9.1