From 2bb4a2bc34048f49815846db354b5c8994669a3c Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期一, 09 五月 2022 17:48:43 +0800
Subject: [PATCH] SF PIPL Page Backup

---
 force-app/main/default/pages/SearchSetProduct.page |  127 ++++++++++++++++++++++++++++-------------
 1 files changed, 86 insertions(+), 41 deletions(-)

diff --git a/force-app/main/default/pages/SearchSetProduct.page b/force-app/main/default/pages/SearchSetProduct.page
index 6919eca..26fb065 100644
--- a/force-app/main/default/pages/SearchSetProduct.page
+++ b/force-app/main/default/pages/SearchSetProduct.page
@@ -1,32 +1,86 @@
-<apex:page id="Page" standardController="Product_Set__c" extensions="SearchSetProductController" sidebar="false" showHeader="false" action="{!init}">
+<apex:page id="Page" standardController="productSet__c" extensions="SearchSetProductController" sidebar="false" showHeader="false" action="{!init}">
+<!-- XHL-20190426-AddStart -->
 <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
 <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
     <script type="text/javascript">
-        function SetProductId(str) {
-            //top.window.opener.setProductEntry(str);
-            top.window.opener.setProductEntryGateway(str);
-            top.window.close();
+
+        function SelectDoneJS(){
+            SelectDone();
+            // alert('1111111111');
+            // SetMuiltProduct();
         }
+
         function SetMuiltProduct(){
+
+            
+
             var Str = j$(escapeVfId("Page:mainForm:setPFString")).value();
-            var isPrepared = j$(escapeVfId("Page:mainForm:DataStatus")).value();
-            if(isPrepared!='Fin'){
-                confirm(isPrepared);
-            }else if(Str==''||Str==null){
+            // alert(Str);
+            var Size = j$(escapeVfId("activitiesSize")).value();
+            var productSetNames = '';
+            var flag = '0';
+            var errorFlag = false;
+            var errorMsg = '';
+            for (var i= 0; i < Size ;i++) {
+                var Checkbox = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+i+":Checkbox")).value();
+                var quantity = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+i+":Quantity")).value();
+                var QuantityReference = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+i+":QuantityReference")).value();
+                var Discount = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+i+":Discount")).value();
+                var Name = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+i+":Name")).value();
+                if (Checkbox == 'on') {
+
+                    if (parseFloat(Discount).toString() == "NaN" || parseFloat(Discount) <= 0 || 
+                        parseFloat(quantity).toString() == "NaN" || quantity.indexOf(".") != -1 || 
+                        parseFloat(quantity) < 0 || (quantity == 0 && quantity == QuantityReference) ) {
+                        errorFlag = true;
+
+                        if (errorMsg == '') {
+                            errorMsg = Name;
+                        } else {
+                            errorMsg = errorMsg + ',' +Name;
+                        }
+                    }
+
+                    if (quantity == 0 && quantity != QuantityReference ) {
+                        flag = '1';
+                        if (productSetNames == '') {
+                            productSetNames = Name;
+                        } else {
+                            productSetNames += ';' + Name;
+                        }
+                    } 
+                    
+                }
+            }
+            if (errorFlag) {
+                alert('鎮ㄥ凡閫夋嫨[ '+errorMsg+' ]浜у搧閰嶅,灏氭湭濉啓鏈夋晥鏁板瓧,璇风‘璁�');
+                return;
+            }
+            if (flag == '1') {
+                if(confirm("鎮ㄥ嵆灏嗗垹闄�"+productSetNames+"锛岀‘璁ゅ畬鎴愪箞锛�")){
+                    
+                    top.window.opener.setProductEntryGateway(Str);
+                    top.window.close();
+                    return;
+                }else{
+                    return;
+                }
+            }
+            
+
+            if(Str==''||Str==null){
                 if(confirm("鎮ㄥ皻鏈�夊彇浠讳綍浜у搧閰嶅锛岀‘璁ゅ畬鎴愪箞锛�")){
+                    top.window.opener.setProductEntryGateway(Str);
                     top.window.close();
                 }else{
                 }
             }else{
-                top.window.opener.setProductEntryGateway(Str);
-                top.window.close();
-            }
+                 top.window.opener.setProductEntryGateway(Str);
+                 top.window.close();
+            } 
+            
         }
-        function DataPrepare() {
-            // body...
-            j$(escapeVfId("Page:mainForm:DataStatus")).val('鏁版嵁灏氭湭鍑嗗濂斤紝璇风◢绛�');
-            SelectDone();
-        }
+        
     </script>
     <style type="text/css">
         div#iframelike {
@@ -38,10 +92,11 @@
     </style>
     <apex:outputPanel id="all">
         <apex:form id="mainForm">
-        <apex:actionFunction action="{!SelectDone}" name="SelectDone" reRender="setPFString,DataStatus" oncomplete="SetMuiltProduct();"/>
+        <apex:actionFunction action="{!SelectDone}" name="SelectDone" reRender="setPFString" oncomplete="SetMuiltProduct();"/>
         <apex:inputHidden value="{!setPFString}" id="setPFString"/>
-        <apex:inputHidden value="{!DataStatus}" id="DataStatus"/>
-            <apex:pageBlock id="idSearchSetProduct" title="{!$Label.Set_Search}">
+        <input type="hidden" id="activitiesSize" value="{!activitiesSize}" />
+            <apex:pageBlock id="idSearchSetProduct" title="{!$Label.Product_Assort_Search}">
+
                 <table width="900" border="0" style="background-color:#DCDCDC">
                     <colgroup>
                         <col width="12" />
@@ -60,7 +115,6 @@
                         <td>&nbsp;</td>
                         <th>{!$Label.Set_Name}</th>
                         <th>{!$Label.Set_Code}</th>
-                        <th>{!$ObjectType.Product_Set__c.fields.Applicable_Department__c.label}</th>
                         <td>&nbsp;</td>
                         <td>&nbsp;</td>
                     </tr>
@@ -70,11 +124,10 @@
                         <td>&nbsp;</td>
                         <td><apex:inputText value="{!SearchName}" style="width:150px" required="false"/></td>
                         <td><apex:inputText value="{!SearchCode}" style="width:150px" required="false"/></td>
-                        <td><apex:selectList value="{! filterName }" size="1" style="width:150px" required="false">
-                            <apex:selectOptions value="{! listViewOptions }"/>
-                        </apex:selectList></td>
+                        
                         <td><apex:commandButton value="{!$Label.Search}" action="{!serContact}" style="width:100px" rerender="idRezultVisitor" /></td>
-                        <td><apex:commandButton value="娣诲姞" onclick="SelectDone()" style="width:100px"/></td>
+                        <!-- <td><apex:commandButton value="娣诲姞" onclick="SelectDone()" style="width:100px"/></td> -->
+                        <td><apex:commandButton value="娣诲姞" onclick="SelectDoneJS();return false;" style="width:100px"/></td>
                     </tr>
                     <tr>
                         <td style="border-bottom: 1px solid #888;" colspan="15">&nbsp;</td>
@@ -93,34 +146,26 @@
                                         <apex:pageBlockTable id="idRezultVisitor" value="{!activities}" var="c" border="1" columns="7" columnsWidth="30px,120px,300px,90x,200px,50px">
                                             <apex:column >
                                                 <apex:facet name="header">閫夋嫨</apex:facet>
-                                                <apex:inputCheckbox value="{!c.isSelected}"/>
-                                            </apex:column>
-                                            <apex:column >
-                                                <apex:facet name="header">Report</apex:facet>
-                                                <apex:outputLink value="{!baseUrl}/{!reportid}?pv1={!c.setProductid}" target="_blank">鈼�</apex:outputLink>
+                                                <apex:inputCheckbox value="{!c.isSelected}" id="Checkbox"/>
                                             </apex:column>
                                             <apex:column >
                                                 <apex:facet name="header">{!$Label.Set_Name}</apex:facet>
-                                                <apex:outputLink value="{!c.Name}" onclick="SetProductId('{!c.setProductidFull}')">{!c.Name}</apex:outputLink>
+                                                <apex:outputText value="{!c.Name}" id="Name"/>   
                                             </apex:column>
                                             <apex:column >
                                                 <apex:facet name="header">{!$Label.Set_Code}</apex:facet>
-                                                <apex:outputText value="{!c.Product_Set_CD_c}" />
+                                                <apex:outputText value="{!c.Code}" />
                                             </apex:column>
                                             <apex:column >
                                                 <apex:facet name="header">{!$Label.Quantity}</apex:facet>
-                                                <apex:outputText value="{!c.Quantity}" />
+                                                <apex:InputText value="{!c.Quantity}" Id="Quantity"/>
+                                                <apex:inputHidden id="QuantityReference" value="{!c.QuantityReference}"/>
                                             </apex:column>
                                             <apex:column >
-                                                <apex:facet name="header">{!$ObjectType.Product_Set__c.Fields.Quote_Select_Info__c.Label}</apex:facet>
-                                                <apex:outputText value="{!c.Quote_Select_Info_c}" />
+                                                <apex:facet name="header">鎶樻墸</apex:facet>
+                                                <apex:InputText value="{!c.Discount}" Id="Discount"/>
                                             </apex:column>
-                                            <apex:column >
-                                                <apex:facet name="header">{!$Label.valid}</apex:facet>
-                                                <apex:outputPanel layout="inline" rendered="{!IF(c.Valid_c,true,false)}" >
-                                                    <img width="16" height="16" title="銉併偋銉冦偗" class="checkImg" alt="銉併偋銉冦偗" src="/img/checkbox_checked.gif"/>
-                                                </apex:outputPanel>
-                                            </apex:column>
+                                            
                                         </apex:pageBlockTable>
                                     </div>
                                     </td>

--
Gitblit v1.9.1