svn commit: r1100589 - in /ofbiz/trunk/applications/product: webapp/catalog/price/setPriceRulesCondEventJs.ftl widget/catalog/PriceForms.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1100589 - in /ofbiz/trunk/applications/product: webapp/catalog/price/setPriceRulesCondEventJs.ftl widget/catalog/PriceForms.xml

jleroux@apache.org
Author: jleroux
Date: Sat May  7 18:43:46 2011
New Revision: 1100589

URL: http://svn.apache.org/viewvc?rev=1100589&view=rev
Log:
When I wrote the new price rules screen I forgot about the dynamic aspect in the condition edit section, I found it by chance today.
This fixes it: you can now swap the INPUT type from a list type (drop-down for the value) to a input value type (like quantity or list price) or vice versa. The last input value is kept in the background, we could resetting the value to null, but I think it makes sense because with the value still in the background it's easy to get back to the original value if you change your mind (or in case of error).

Modified:
    ofbiz/trunk/applications/product/webapp/catalog/price/setPriceRulesCondEventJs.ftl
    ofbiz/trunk/applications/product/widget/catalog/PriceForms.xml

Modified: ofbiz/trunk/applications/product/webapp/catalog/price/setPriceRulesCondEventJs.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/price/setPriceRulesCondEventJs.ftl?rev=1100589&r1=1100588&r2=1100589&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/price/setPriceRulesCondEventJs.ftl (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/price/setPriceRulesCondEventJs.ftl Sat May  7 18:43:46 2011
@@ -18,18 +18,14 @@ under the License.
 -->
 <script type="text/javascript">
 jQuery(document).ready( function() {
-
 <#if 0 < productPriceConds.size()>
   <#list 0..productPriceConds.size()-1 as i>
     if (document.getElementById('EditProductPriceRulesCond_o_${i}')) {
+      jQuery('#EditProductPriceRulesCond_condValueInput_o_${i}').hide();
       jQuery('#EditProductPriceRulesCond_inputParamEnumId_o_${i}').change( function() {
-    <#if 'PRIP_QUANTITY' != productPriceConds[i].inputParamEnumId && 'PRIP_LIST_PRICE' != productPriceConds[i].inputParamEnumId>
-        getDependentDropdownValues('getAssociatedPriceRulesConds', 'inputParamEnumId', 'EditProductPriceRulesCond_inputParamEnumId_o_${i}', 'EditProductPriceRulesCond_condValue_o_${i}', 'productPriceRulesCondValues', 'condValue_o_${i}', 'description');
-    </#if>
-      });
-    <#if 'PRIP_QUANTITY' != productPriceConds[i].inputParamEnumId && 'PRIP_LIST_PRICE' != productPriceConds[i].inputParamEnumId>
-      getDependentDropdownValues('getAssociatedPriceRulesConds', 'inputParamEnumId', 'EditProductPriceRulesCond_inputParamEnumId_o_${i}', 'EditProductPriceRulesCond_condValue_o_${i}', 'productPriceRulesCondValues', 'condValue_o_${i}', 'description', '${productPriceConds[i].condValue}');
-    </#if>
+        getDependentDropdownValues('getAssociatedPriceRulesConds', 'inputParamEnumId', 'EditProductPriceRulesCond_inputParamEnumId_o_${i}', 'EditProductPriceRulesCond_condValue_o_${i}', 'productPriceRulesCondValues', 'condValue_o_${i}', 'description', '', '', '', '', 'EditProductPriceRulesCond_condValueInput_o_${i}');
+    });
+    getDependentDropdownValues('getAssociatedPriceRulesConds', 'inputParamEnumId', 'EditProductPriceRulesCond_inputParamEnumId_o_${i}', 'EditProductPriceRulesCond_condValue_o_${i}', 'productPriceRulesCondValues', 'condValue_o_${i}', 'description', '', '', '', '', 'EditProductPriceRulesCond_condValueInput_o_${i}');
     }
   </#list>
 </#if>

Modified: ofbiz/trunk/applications/product/widget/catalog/PriceForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/PriceForms.xml?rev=1100589&r1=1100588&r2=1100589&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/catalog/PriceForms.xml (original)
+++ ofbiz/trunk/applications/product/widget/catalog/PriceForms.xml Sat May  7 18:43:46 2011
@@ -92,17 +92,12 @@
                 </entity-options>
             </drop-down>
         </field>        
-        <field use-when="&quot;PRIP_QUANTITY&quot;.equals(inputParamEnumId) || &quot;PRIP_LIST_PRICE&quot;.equals(inputParamEnumId)"
-            name="condValueInput" title="${uiLabelMap.ProductValue}">
-            <text size="10" default-value="${condValue}"/>
-        </field>                
-        <field
-            use-when="!&quot;PRIP_QUANTITY&quot;.equals(inputParamEnumId) &amp;&amp; !&quot;PRIP_LIST_PRICE&quot;.equals(inputParamEnumId)"
-            name="condValue" title="${uiLabelMap.CommonEmptyHeader}">
-            <drop-down allow-empty="false" current="selected">
-                <list-options list-name="productPriceRulesCondValues" key-name="condValue"/>
+        <field name="condValueInput" title="${uiLabelMap.ProductValue}" entry-name="condValue"><text size="10"/></field>
+        <field name="condValue" title="${uiLabelMap.CommonEmptyHeader}">
+            <drop-down allow-empty="false">
+                <list-options list-name="productPriceRulesCondValues" key-name="condValue"/>                
             </drop-down>
-        </field>                
+        </field>
         <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit/></field>        
         <field name="deleteLink" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext" widget-area-style="align-text">
             <hyperlink target="deleteProductPriceCond" description="${uiLabelMap.CommonRemove}">