From 4420517bbbffea48cabe7a7dcdf2e1c4b440fc85 Mon Sep 17 00:00:00 2001
From: GWY <guweiyi@prec-tech.com>
Date: 星期一, 30 五月 2022 16:15:26 +0800
Subject: [PATCH] 两个LS特殊条件在说明的增减
---
force-app/main/default/pages/NewLoanerApplication.page | 289 +++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 259 insertions(+), 30 deletions(-)
diff --git a/force-app/main/default/pages/NewLoanerApplication.page b/force-app/main/default/pages/NewLoanerApplication.page
index c8da600..00b63f3 100644
--- a/force-app/main/default/pages/NewLoanerApplication.page
+++ b/force-app/main/default/pages/NewLoanerApplication.page
@@ -2,26 +2,212 @@
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
-
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
+ <apex:includeScript value="{!URLFOR($Resource.AWSService, 'AWSService.js') }" />
+ <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
+ <!-- Update 20220318 By Yang Kaiyu End -->
<script>
- function saveJs() {
- blockme();
- saveBtn();
- }
-
- function cancelJs() {
- var baseUrl = '{!baseUrl}';
- var rtUrl = '{!contactID}';
- if (rtUrl == 'null' || rtUrl == '') {
- rtUrl = '{!accountID}';
+ // Update 20220318 By Yang Kaiyu Start
+ aws_result = '';
+ lu_aws_result = '';
+ AWSService.sfSessionId = '{!GETSESSIONID()}';
+ var staticResource = JSON.parse('{!staticResource}');
+ var staticResourceContact = JSON.parse('{!staticResourceContact}');
+ var staticResourceLoanerUser = JSON.parse('{!staticResourceLoanerUser}');
+ function searchPI(){
+ console.log('---searchPI---');
+ var conAwsDataid ='';
+ conAwsDataid = document.getElementById("page:mainfrom:idSearchSetProduct:con_AWS_Data_Id__c").value;
+ if(conAwsDataid){
+ blockme();
+ console.log('---AWSService---');
+ AWSService.query(staticResourceContact.queryUrl,conAwsDataid,function(data){
+ unblockUI();
+ if(data.object){
+ console.log('----------------data-----------------');
+ console.log(data);
+ console.log('----------------data-----------------');
+ document.getElementById("page:mainfrom:idSearchSetProduct:Contact__c").value = '{!contactID}';
+ document.getElementById("page:mainfrom:idSearchSetProduct:ContactNumber__c").value = data.object.phone;
+ if(document.getElementById("page:mainfrom:idSearchSetProduct:ContactNumber__c").value){
+ AWSService.post(staticResourceLoanerUser.newUrl, GetLUObj(), function(result){
+ if(result && result.object){
+ lu_aws_result = result;
+ console.log('----------------result-----------------');
+ console.log(result);
+ console.log('----------------result-----------------');
+ document.getElementById("page:mainfrom:idSearchSetProduct:lu_AWS_Data_Id__c").value = result.object.dataId;
+ document.getElementById("page:mainfrom:idSearchSetProduct:ContactNumber__c").value = result.object.phone;
+ document.getElementById("page:mainfrom:idSearchSetProduct:ContactNumber_Encrypted__c").value = result.object.phoneEncrypted;
+ }
+ }, staticResourceLoanerUser.token);
+ }
+ }
+ },staticResourceContact.token);
+ }
}
- window.location.href = baseUrl + "/" + rtUrl;
- }
+ function GetLUObj(){
+ return JSON.stringify([{
+ contactNumber : document.getElementById("page:mainfrom:idSearchSetProduct:ContactNumber__c").value,
+ dataId : document.getElementById("page:mainfrom:idSearchSetProduct:lu_AWS_Data_Id__c").value,
+ }]);
+ }
+ function ProcessPI(sobjJson, payloadForNewPI,callback) {
+ console.log('---insert---');
+ AWSService.post(staticResource.newUrl, payloadForNewPI, function(result){
+ aws_result = result
+ SetEditObj();
+ if(callback){
+ callback();
+ }
+ }, staticResource.token);
+ }
+ function SetEditObj(){
+ let obj = GetAWSResultObj();
+ if(obj){
+ document.getElementById("page:mainfrom:idSearchSetProduct:AWS_Data_Id__c").value = obj.dataId;
+
+ document.getElementById("page:mainfrom:idSearchSetProduct:ReceiveInfo:pc:Post_Code__c").value = obj.postCode;
+ document.getElementById("page:mainfrom:idSearchSetProduct:ReceiveInfo:lrsp:Loaner_receive_staff_phone__c").value= obj.loanerReceiveStaffPhone;
+ document.getElementById("page:mainfrom:idSearchSetProduct:ReceiveInfo:lrs:Loaner_receive_staff__c").value = obj.loanerReceiveStaff;
+ document.getElementById("page:mainfrom:idSearchSetProduct:LoanerApplicationDetailInfo:ls:Loaner_Ser__c").value = obj.loanerSer;
+ document.getElementById("page:mainfrom:idSearchSetProduct:ReceiveInfo:dsa:direct_shippment_address__c").value = obj.directShippmentAddress;
+
+ document.getElementById("page:mainfrom:idSearchSetProduct:direct_shippment_address_Encrypted__c").value = obj.directShippmentAddressEncrypt;
+ document.getElementById("page:mainfrom:idSearchSetProduct:Pos_Code_Encrypted__c").value = obj.postCodeEncrypt;
+ document.getElementById("page:mainfrom:idSearchSetProduct:Loaner_receive_staff_phone_Encrypted__c").value = obj.loanerReceiveStaffPhoneEncrypt;
+ document.getElementById("page:mainfrom:idSearchSetProduct:Loaner_receive_staff_Encrypted__c").value = obj.loanerReceiveStaffEncrypt;
+ document.getElementById("page:mainfrom:idSearchSetProduct:Loaner_Ser_Encrypted__c").value = obj.loanerSerEncrypt;
+ }
+ }
+ function GetAWSResultObj(){
+ if(aws_result && aws_result.object && aws_result.object.length > 0){
+ return aws_result.object[0];
+ }
+ return null;
+ }
+ function GetObj(){
+ return JSON.stringify([{
+ dataId : document.getElementById("page:mainfrom:idSearchSetProduct:AWS_Data_Id__c").value,
+ postCode : document.getElementById("page:mainfrom:idSearchSetProduct:ReceiveInfo:pc:Post_Code__c").value,
+ loanerReceiveStaffPhone : document.getElementById("page:mainfrom:idSearchSetProduct:ReceiveInfo:lrsp:Loaner_receive_staff_phone__c").value,
+ loanerReceiveStaff : document.getElementById("page:mainfrom:idSearchSetProduct:ReceiveInfo:lrs:Loaner_receive_staff__c").value,
+ loanerSer : document.getElementById("page:mainfrom:idSearchSetProduct:LoanerApplicationDetailInfo:ls:Loaner_Ser__c").value,
+ directShippmentAddress : document.getElementById("page:mainfrom:idSearchSetProduct:ReceiveInfo:dsa:direct_shippment_address__c").value,
+ }]);
+
+ }
+
+ var bt1 = false;
+ var bt2 = false;
+ var laid = '';
+ function Redirect(){
+ if(bt1 && bt2){
+ window.location.href = '/'+laid;
+ }
+ }
+
+
+
+ //aws 纭
+ function Transla(){
+ let e = HasError();
+ if(!e){
+ AWSService.post(staticResourceLoanerUser.transactionUrl, JSON.stringify({
+ "txId":lu_aws_result.txId,
+ "isSuccess":e ? 0 : 1
+ }), function(result){
+ console.log('---result---');
+ console.log(result);
+ console.log('finish');
+ bt1=true;
+ Redirect();
+ //window.location.reload();
+ }, staticResourceLoanerUser.token);
+ }
+ }
+ function Trans(){
+ let b = HasError();
+ console.log('---HasError---');
+ console.log(b);
+ console.log('---aws_result---');
+ console.log(aws_result);
+ if(b){
+ //娓呯┖pi
+ document.getElementById('page:mainfrom:idSearchSetProduct:ReceiveInfo:pc:Post_Code__c').value=''
+ document.getElementById('page:mainfrom:idSearchSetProduct:ReceiveInfo:lrsp:Loaner_receive_staff_phone__c').value=''
+ document.getElementById('page:mainfrom:idSearchSetProduct:ReceiveInfo:lrs:Loaner_receive_staff__c').value=''
+ document.getElementById('page:mainfrom:idSearchSetProduct:LoanerApplicationDetailInfo:ls:Loaner_Ser__c').value=''
+ document.getElementById('page:mainfrom:idSearchSetProduct:ReceiveInfo:dsa:direct_shippment_address__c').value=''
+ }
+ AWSService.post(staticResource.transactionUrl, JSON.stringify({
+ "txId":aws_result.txId,
+ "isSuccess":b ? 0 : 1
+ }), function(result){
+ console.log('---result---');
+ console.log(result);
+ console.log('finish');
+ bt2=true;
+ Redirect();
+ //window.location.reload();
+ }, staticResource.token);
+
+ }
+ function HasError(){
+ let e = document.getElementById("page:mainfrom:message");
+ console.log(e);
+ if (!e) {
+ return false;
+ }
+
+ if(j$(e).find(".editListError").length > 0){
+ return true;
+ }
+
+ let divs = j$(e).find("div.message");
+ for (let i = 0; i < divs.length; i++) {
+ for (let j = 0; j < divs[i].classList.length; j++) {
+ for(let cls in divs[i].classList){
+ if (cls.indexOf('error')>-1) {
+ return true;
+ }
+ }
+
+ }
+
+ }
+ return false;
+ }
+ // Update 20220318 By Yang Kaiyu End
+
+ function saveJs() {
+ blockme();
+ // Update 20220318 By Yang Kaiyu Start
+ searchPI();
+ ProcessPI({},GetObj(),function(){
+ saveBtn();
+ });
+ // Update 20220318 By Yang Kaiyu End
+ }
+
+ function cancelJs() {
+ var baseUrl = '{!baseUrl}';
+ var rtUrl = '{!contactID}';
+ if (rtUrl == 'null' || rtUrl == '') {
+ rtUrl = '{!accountID}';
+ }
+ window.location.href = baseUrl + "/" + rtUrl;
+ }
</script>
<apex:form id="mainfrom">
-
- <apex:actionFunction action="{!saveBtn}" name="saveBtn" reRender="mainForm,message" oncomplete="unblockUI();"/>
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <script>
+ laid = '{!laid}';
+ </script>
+ <!-- Update 20220318 By Yang Kaiyu End -->
+ <apex:actionFunction action="{!saveBtn}" name="saveBtn" reRender="mainfrom,message" oncomplete="unblockUI();Transla();Trans();"/>
<apex:actionFunction action="{!cancelBtn}" name="cancelBtn" reRender="mainForm,message" oncomplete="unblockUI();"/>
<apex:outputPanel id="message">
@@ -35,7 +221,9 @@
</apex:pageBlockButtons>
<apex:outputPanel layout="none" >
- <apex:pageBlockSection title="鏍锋満鍊熷嚭鐢宠璇︾粏淇℃伅" columns="2">
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <apex:pageBlockSection id="LoanerApplicationDetailInfo" title="鏍锋満鍊熷嚭鐢宠璇︾粏淇℃伅" columns="2">
+ <!-- Update 20220318 By Yang Kaiyu End -->
<apex:pageBlockSectionItem >
<apex:outputLabel value="鏍锋満鍊熷嚭鐢宠鍚嶇О" for="la_Name"/>
@@ -45,11 +233,15 @@
<apex:outputLabel value="鏍锋満鍒嗙被" for="la_Type"/>
<apex:inputField value="{!la.Equipment_Type__c}" id="la_Type" required="true"/>
</apex:pageBlockSectionItem>
- <apex:pageBlockSectionItem >
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <apex:pageBlockSectionItem id="ls" >
+ <!-- Update 20220318 By Yang Kaiyu End -->
<apex:outputLabel value="鍊熺敤鎷呭綋" for="Loaner_Ser__c"/>
- <apex:inputField value="{!la.Loaner_Ser__c}" id="Loaner_Ser__c" required="true"/>
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <apex:inputField value="{!la.Loaner_Ser__c}" id="Loaner_Ser__c" required="true"/><!--pi-->
+ <!-- Update 20220318 By Yang Kaiyu End -->
</apex:pageBlockSectionItem>
-
+
<apex:pageBlockSectionItem rendered="{!IF(userType == 'Standard', false , true)}">
<apex:outputLabel value="瀹℃壒浜�" for="Approver__c"/>
<apex:inputField value="{!la.Approver__c}" id="Approver__c" required="true"/>
@@ -317,35 +509,70 @@
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
- <apex:pageBlockSection title="鏀朵欢浜轰俊鎭�" columns="2">
- <apex:pageBlockSectionItem >
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <apex:pageBlockSection id="ReceiveInfo" title="鏀朵欢浜轰俊鎭�" columns="2">
+ <apex:pageBlockSectionItem id="lrs" >
+ <!-- Update 20220318 By Yang Kaiyu End -->
<apex:outputLabel value="鏀朵欢浜哄鍚�" for="Loaner_receive_staff__c"/>
- <apex:inputField value="{!la.Loaner_receive_staff__c}" id="Loaner_receive_staff__c"/>
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <apex:inputField value="{!la.Loaner_receive_staff__c}" id="Loaner_receive_staff__c"/><!--pi-->
+ <!-- Update 20220318 By Yang Kaiyu End -->
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="鑷彁鏃堕棿" for="pickup_time__c"/>
<apex:inputField value="{!la.pickup_time__c}" id="pickup_time__c"/>
</apex:pageBlockSectionItem>
- <apex:pageBlockSectionItem >
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <apex:pageBlockSectionItem id="dsa" >
+ <!-- Update 20220318 By Yang Kaiyu End -->
<apex:outputLabel value="鏀朵欢浜鸿缁嗗湴鍧�" for="direct_shippment_address__c"/>
- <apex:inputField value="{!la.direct_shippment_address__c}" id="direct_shippment_address__c"/>
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <apex:inputField value="{!la.direct_shippment_address__c}" id="direct_shippment_address__c"/><!--pi-->
+ <!-- Update 20220318 By Yang Kaiyu End -->
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
- <apex:pageBlockSectionItem >
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <apex:pageBlockSectionItem id="lrsp" >
+ <!-- Update 20220318 By Yang Kaiyu End -->
<apex:outputLabel value="鏀朵欢浜虹數璇�" for="Loaner_receive_staff_phone__c"/>
- <apex:inputField value="{!la.Loaner_receive_staff_phone__c}" id="Loaner_receive_staff_phone__c"/>
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <apex:inputField value="{!la.Loaner_receive_staff_phone__c}" id="Loaner_receive_staff_phone__c"/><!--pi-->
+ <!-- Update 20220318 By Yang Kaiyu Emd -->
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
</apex:pageBlockSectionItem>
- <apex:pageBlockSectionItem >
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <apex:pageBlockSectionItem id="pc" >
+ <!-- Update 20220318 By Yang Kaiyu End -->
<apex:outputLabel value="閭紪" for="Post_Code__c"/>
- <apex:inputField value="{!la.Post_Code__c}" id="Post_Code__c"/>
- </apex:pageBlockSectionItem>
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <apex:inputField value="{!la.Post_Code__c}" id="Post_Code__c"/><!--pi-->
+ <!-- Update 20220318 By Yang Kaiyu End -->
+ </apex:pageBlockSectionItem>
</apex:pageBlockSection>
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <apex:inputHidden id="AWS_Data_Id__c" value="{!la.AWS_Data_Id__c}"/>
+ <apex:inputHidden id="Loaner_Ser_Encrypted__c" value="{!la.Loaner_Ser_Encrypted__c}"/>
+ <apex:inputHidden id="Pos_Code_Encrypted__c" value="{!la.Pos_Code_Encrypted__c}"/>
+ <apex:inputHidden id="direct_shippment_address_Encrypted__c" value="{!la.direct_shippment_address_Encrypted__c}"/>
+ <apex:inputHidden id="Loaner_receive_staff_phone_Encrypted__c" value="{!la.Loaner_receive_staff_phone_Encrypted__c}"/>
+ <input id="page:mainfrom:idSearchSetProduct:Loaner_receive_staff_Encrypted__c" type="hidden" name="page:mainfrom:idSearchSetProduct:Loaner_receive_staff_Encrypted__c" value="{!la.Loaner_receive_staff_Encrypted__c}"/>
+ <apex:inputHidden id="Contact__c" value="{!lu.Contact__c}"/>
+ <!-- <apex:inputHidden id="lu_AWS_Data_Id__c" value="{!lu.AWS_Data_Id__c}"/> -->
+ <apex:inputHidden id="ContactNumber__c" value="{!lu.ContactNumber__c}"/>
+ <apex:inputHidden id="ContactNumber_Encrypted__c" value="{!lu.ContactNumber_Encrypted__c}"/>
+ <!-- <input id="page:mainfrom:idSearchSetProduct:Contact__c" type="hidden" name="page:mainfrom:idSearchSetProduct:Contact__c" value="{!lu.Contact__c}"/> -->
+ <input id="page:mainfrom:idSearchSetProduct:lu_AWS_Data_Id__c" type="hidden" name="page:mainfrom:idSearchSetProduct:lu_AWS_Data_Id__c" value="{!lu.AWS_Data_Id__c}"/>
+ <!-- <input id="page:mainfrom:idSearchSetProduct:ContactNumber__c" type="hidden" name="page:mainfrom:idSearchSetProduct:ContactNumber__c" value="{!lu.ContactNumber__c}"/> -->
+ <!-- <input id="page:mainfrom:idSearchSetProduct:ContactNumber_Encrypted__c" type="hidden" name="page:mainfrom:idSearchSetProduct:ContactNumber_Encrypted__c" value="{!lu.ContactNumber_Encrypted__c}"/> -->
+
+ <apex:inputHidden id="con_AWS_Data_Id__c" value="{!con.AWS_Data_Id__c}"/>
+ <apex:inputHidden id="con_id" value="{!con.id}"/>
+ <!-- Update 20220318 By Yang Kaiyu End -->
<apex:pageBlockSection title="澶囨敞" >
<apex:pageBlockSectionItem >
<apex:outputLabel value="澶囨敞" for="loaner_Remark__c"/>
@@ -374,7 +601,9 @@
<apex:inputField value="{!la.DealerOrder_From__c}" id="DealerOrder_From__c"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
-
+ <!-- Update 20220318 By Yang Kaiyu Start -->
+ <!-- <apex:inputHidden id="Loaner_receive_staff_Encrypted__c" value="{!la.Loaner_receive_staff_Encrypted__c}"/> -->
+ <!-- Update 20220318 By Yang Kaiyu End -->
--
Gitblit v1.9.1