<#-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <#if productPromoId?? && productPromo??>

${uiLabelMap.PageTitleEditProductPromoRules}

<#-- ======================= Rules ======================== -->
<#assign ruleClass = "2"> <#list productPromoRules as productPromoRule> <#assign productPromoConds = productPromoRule.getRelated("ProductPromoCond", null, null, false)> <#assign productPromoActions = productPromoRule.getRelated("ProductPromoAction", null, null, false)> <#if productPromoRule_index != 0> alternate-row"> alternate-row"> alternate-row"> <#-- toggle the row color --> <#if "2" == ruleClass> <#assign ruleClass = "1"> <#else> <#assign ruleClass = "2">
${uiLabelMap.ProductRuleId} ${uiLabelMap.ProductRuleName}  

${uiLabelMap.ProductRule} ${(productPromoRule.productPromoRuleId)!}
  <#if (productPromoConds.size() == 0 && productPromoActions.size() == 0)>

${uiLabelMap.ProductConditionsForRule} ${(productPromoRule.productPromoRuleId)!} : <#assign maxCondSeqId = 1> <#assign condClass = "2"> <#list productPromoConds as productPromoCond> alternate-row"> <#if (productPromoCond.productPromoCondSeqId)??> <#assign curCondSeqId = Static["java.lang.Integer"].valueOf(productPromoCond.getString("productPromoCondSeqId"))> <#if (curCondSeqId >= maxCondSeqId)> <#assign maxCondSeqId = curCondSeqId + 1> <#-- toggle the row color --> <#if "1" == condClass> <#assign condClass = "1"> <#else> <#assign condClass = "2">
${uiLabelMap.ProductCondition} ${(productPromoCond.productPromoCondSeqId)!}.           ${uiLabelMap.ProductConditionXquantityOfProduct}
<#assign otherValue = productPromoCond.otherValue!> value="${(productPromoCond.otherValue)!}" /> <#-- Reseting the values of carrierParty and carrierShippingMethod assigned in previous iteration of productPromoConds --> <#assign carrierShippingMethod = ""/> <#assign carrierParty = ""/> <#if otherValue?has_content && otherValue.contains("@")> <#assign carrierShippingMethod = productPromoCond.otherValue!> <#if carrierShippingMethod?has_content> <#assign carrierParty = carrierShippingMethod.substring(0, carrierShippingMethod.indexOf("@"))> <#assign shippingMethodTypeId = carrierShippingMethod.substring(carrierShippingMethod.indexOf("@")+1)> <#assign description = (delegator.findOne("ShipmentMethodType", {"shipmentMethodTypeId":shippingMethodTypeId}, false)).description> <#else> <#assign description = "">
<#-- ======================= Categories ======================== -->
${uiLabelMap.ProductConditionsCategoriesForCondition} ${(productPromoCond.productPromoCondSeqId)!}:
<#assign condProductPromoCategories = productPromoCond.getRelated("ProductPromoCategory", null, null, false)> <#if condProductPromoCategories?has_content> <#list condProductPromoCategories as condProductPromoCategory> <#assign condProductCategory = condProductPromoCategory.getRelatedOne("ProductCategory", true)> <#assign condApplEnumeration = condProductPromoCategory.getRelatedOne("ApplEnumeration", true)>
${(condProductCategory.get("description",locale))!} [${condProductPromoCategory.productCategoryId}] - ${(condApplEnumeration.get("description",locale))?default(condProductPromoCategory.productPromoApplEnumId)} - ${uiLabelMap.ProductSubCats}? ${condProductPromoCategory.includeSubCategories?default("N")} - ${uiLabelMap.CommonAnd} ${uiLabelMap.CommonGroup}: ${condProductPromoCategory.andGroupId}
<#else>
${uiLabelMap.ProductNoConditionCategories}
<@htmlTemplate.lookupField formName="createProductPromoCategoryConditions" name="productCategoryId" id="productCategoryId_cond" fieldFormName="LookupProductCategory"/> ${uiLabelMap.CommonAnd} ${uiLabelMap.CommonGroup}: *
<#-- ======================= Products ======================== -->
${uiLabelMap.ProductConditionsProductsForCondition} ${(productPromoCond.productPromoCondSeqId)!}:
<#assign condProductPromoProducts = productPromoCond.getRelated("ProductPromoProduct", null, null, false)> <#if condProductPromoProducts?has_content> <#list condProductPromoProducts as condProductPromoProduct> <#assign condProduct = condProductPromoProduct.getRelatedOne("Product", true)!> <#assign condApplEnumeration = condProductPromoProduct.getRelatedOne("ApplEnumeration", true)>
${(condProduct.internalName)!} [${condProductPromoProduct.productId}] - ${(condApplEnumeration.get("description",locale))?default(condProductPromoProduct.productPromoApplEnumId)}
${uiLabelMap.CommonDelete}
<#else>
${uiLabelMap.ProductNoConditionProducts}
<@htmlTemplate.lookupField formName="createProductPromoProductConditions" name="productId" id="productId" fieldFormName="LookupProduct"/>
${uiLabelMap.CommonNew}  ${uiLabelMap.CommonOther}:

${uiLabelMap.ProductActionForRule} ${(productPromoRule.productPromoRuleId)!} : <#assign actionClass = "2"> <#list productPromoActions as productPromoAction> alternate-row"> <#-- toggle the row color --> <#if "2" == actionClass> <#assign actionClass = "1"> <#else> <#assign actionClass = "2">
${uiLabelMap.ProductAction} ${(productPromoAction.productPromoActionSeqId)!}
${uiLabelMap.ProductQuantity}:  ${uiLabelMap.ProductAmount}: 
${uiLabelMap.ProductItemId}: <@htmlTemplate.lookupField value="${(productPromoAction.productId)!}" formName="updateProductPromoAction" name="productId" id="productId" fieldFormName="LookupProduct"/>
${uiLabelMap.PartyParty}: <@htmlTemplate.lookupField value="${(productPromoAction.partyId)!}" formName="updateProductPromoAction" name="partyId" id="partyId" fieldFormName="LookupUserLoginAndPartyDetails"/>
${uiLabelMap.ProductServiceName}:  ${uiLabelMap.UseCartQuantity}: 
<#-- ======================= Categories ======================== -->
${uiLabelMap.ProductActionsCategoriesForAction} ${(productPromoAction.productPromoActionSeqId)!}:
<#assign actionProductPromoCategories = productPromoAction.getRelated("ProductPromoCategory", null, null, false)> <#if actionProductPromoCategories?has_content> <#list actionProductPromoCategories as actionProductPromoCategory> <#assign actionProductCategory = actionProductPromoCategory.getRelatedOne("ProductCategory", true)> <#assign actionApplEnumeration = actionProductPromoCategory.getRelatedOne("ApplEnumeration", true)>
${(actionProductCategory.description)!} [${actionProductPromoCategory.productCategoryId}] - ${(actionApplEnumeration.get("description",locale))?default(actionProductPromoCategory.productPromoApplEnumId)} - ${uiLabelMap.ProductSubCats}? ${actionProductPromoCategory.includeSubCategories?default("N")} - ${uiLabelMap.CommonAnd} ${uiLabelMap.CommonGroup}: ${actionProductPromoCategory.andGroupId}
<#else>
${uiLabelMap.ProductNoActionCategories}

<@htmlTemplate.lookupField formName="createProductPromoCategoryActions" name="productCategoryId" id="productCategoryId_act" fieldFormName="LookupProductCategory"/> ${uiLabelMap.CommonAnd} ${uiLabelMap.CommonGroup}: *
<#-- ======================= Products ======================== -->
${uiLabelMap.ProductActionsProductsForAction} ${(productPromoAction.productPromoActionSeqId)!}:
<#assign actionProductPromoProducts = productPromoAction.getRelated("ProductPromoProduct", null, null, false)> <#if actionProductPromoProducts?has_content> <#list actionProductPromoProducts as actionProductPromoProduct> <#assign actionProduct = actionProductPromoProduct.getRelatedOne("Product", true)!> <#assign actionApplEnumeration = actionProductPromoProduct.getRelatedOne("ApplEnumeration", true)>
${(actionProduct.internalName)!} [${actionProductPromoProduct.productId}] - ${(actionApplEnumeration.get("description",locale))?default(actionProductPromoProduct.productPromoApplEnumId)}
<#else>
${uiLabelMap.ProductNoActionProducts}
<@htmlTemplate.lookupField formName="createProductPromoProductActions" name="productId" id="productId" fieldFormName="LookupProduct"/>
${uiLabelMap.CommonNew}:  ${uiLabelMap.ProductQuantity}:  ${uiLabelMap.ProductAmount}: 
${uiLabelMap.ProductItemId}:<@htmlTemplate.lookupField formName="createProductPromoAction" name="productId" id="productId" fieldFormName="LookupProduct"/>
${uiLabelMap.PartyParty}: <@htmlTemplate.lookupField formName="createProductPromoAction" name="partyId" id="partyId" fieldFormName="LookupUserLoginAndPartyDetails"/>
${uiLabelMap.ProductServiceName}:  ${uiLabelMap.UseCartQuantity}: 
<#-- This was removed in r697962, should have been only commented out as maybe in future will be used again (free shipping promo)
${uiLabelMap.ProductNoteOnItemId} : ${uiLabelMap.ProductItemIdGiftPurchaseFreeShipping}
${uiLabelMap.ProductNoteOnPartyId} : ${uiLabelMap.ProductPartyFreeShipping}
-->

${uiLabelMap.ProductAddPromoRule}

${uiLabelMap.ProductName}

${uiLabelMap.ProductPromotion} ${uiLabelMap.ProductCategories}

<#-- ======================= Categories ======================== -->
<#list promoProductPromoCategories as promoProductPromoCategory> <#assign promoProductCategory = promoProductPromoCategory.getRelatedOne("ProductCategory", true)> <#assign promoApplEnumeration = promoProductPromoCategory.getRelatedOne("ApplEnumeration", true)>
${(promoProductCategory.description)!} [${promoProductPromoCategory.productCategoryId}] - ${(promoApplEnumeration.get("description",locale))?default(promoProductPromoCategory.productPromoApplEnumId)} - ${uiLabelMap.ProductSubCats}? ${promoProductPromoCategory.includeSubCategories?default("N")} - ${uiLabelMap.CommonAnd} ${uiLabelMap.CommonGroup}: ${promoProductPromoCategory.andGroupId}
<@htmlTemplate.lookupField formName="createProductPromoCategoryPromotions" name="productCategoryId" id="productCategoryId_03" fieldFormName="LookupProductCategory"/> ${uiLabelMap.CommonAnd} ${uiLabelMap.CommonGroup}: *

${uiLabelMap.ProductPromotionProducts}

<#-- ======================= Products ======================== -->
<#list promoProductPromoProducts as promoProductPromoProduct> <#assign promoProduct = promoProductPromoProduct.getRelatedOne("Product", true)!> <#assign promoApplEnumeration = promoProductPromoProduct.getRelatedOne("ApplEnumeration", true)>
${(promoProduct.internalName)!} [${promoProductPromoProduct.productId}] - ${(promoApplEnumeration.get("description",locale))?default(promoProductPromoProduct.productPromoApplEnumId)}
${uiLabelMap.ProductProductId}*<@htmlTemplate.lookupField formName="createpromoproductform" name="productId" id="productId" fieldFormName="LookupProduct"/>