<#-- 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?exists && productPromo?exists>

${uiLabelMap.PageTitleEditProductPromoRules}

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

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

${uiLabelMap.ProductConditionsForRule} ${(productPromoRule.productPromoRuleId)?if_exists} : <#assign maxCondSeqId = 1> <#assign condClass = "2"> <#list productPromoConds as productPromoCond> alternate-row"> <#if (productPromoCond.productPromoCondSeqId)?exists> <#assign curCondSeqId = Static["java.lang.Integer"].valueOf(productPromoCond.getString("productPromoCondSeqId"))> <#if (curCondSeqId >= maxCondSeqId)> <#assign maxCondSeqId = curCondSeqId + 1> <#-- toggle the row color --> <#if condClass == "2"> <#assign condClass = "1"> <#else> <#assign condClass = "2">
${uiLabelMap.ProductCondition} ${(productPromoCond.productPromoCondSeqId)?if_exists}
<#assign otherValue = productPromoCond.otherValue?if_exists> value="${(productPromoCond.otherValue)?if_exists}" /> <#if otherValue?has_content && otherValue.contains("@")> <#assign carrierShippingMethod = productPromoCond.otherValue?if_exists> <#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 = "">
${uiLabelMap.CommonDelete}
<#-- ======================= Categories ======================== -->
${uiLabelMap.ProductConditionsCategoriesForCondition} ${(productPromoCond.productPromoCondSeqId)?if_exists}:
<#assign condProductPromoCategories = productPromoCond.getRelated("ProductPromoCategory")> <#if condProductPromoCategories?has_content> <#list condProductPromoCategories as condProductPromoCategory> <#assign condProductCategory = condProductPromoCategory.getRelatedOneCache("ProductCategory")> <#assign condApplEnumeration = condProductPromoCategory.getRelatedOneCache("ApplEnumeration")>
${(condProductCategory.get("description",locale))?if_exists} [${condProductPromoCategory.productCategoryId}] - ${(condApplEnumeration.get("description",locale))?default(condProductPromoCategory.productPromoApplEnumId)} - ${uiLabelMap.ProductSubCats}? ${condProductPromoCategory.includeSubCategories?default("N")} - ${uiLabelMap.CommonAnd} ${uiLabelMap.CommonGroup}: ${condProductPromoCategory.andGroupId}
${uiLabelMap.CommonDelete}
<#else>
${uiLabelMap.ProductNoConditionCategories}
<@htmlTemplate.lookupField formName="createProductPromoCategoryConditions" name="productCategoryId" id="productCategoryId_cond" fieldFormName="LookupProductCategory"/> ${uiLabelMap.CommonAnd} ${uiLabelMap.CommonGroup}: *
<#-- ======================= Products ======================== -->
${uiLabelMap.ProductConditionsProductsForCondition} ${(productPromoCond.productPromoCondSeqId)?if_exists}:
<#assign condProductPromoProducts = productPromoCond.getRelated("ProductPromoProduct")> <#if condProductPromoProducts?has_content> <#list condProductPromoProducts as condProductPromoProduct> <#assign condProduct = condProductPromoProduct.getRelatedOneCache("Product")?if_exists> <#assign condApplEnumeration = condProductPromoProduct.getRelatedOneCache("ApplEnumeration")>
${(condProduct.internalName)?if_exists} [${condProductPromoProduct.productId}] - ${(condApplEnumeration.get("description",locale))?default(condProductPromoProduct.productPromoApplEnumId)}
${uiLabelMap.CommonDelete}
<#else>
${uiLabelMap.ProductNoConditionProducts}
${uiLabelMap.ProductProductId}:
${uiLabelMap.CommonNew}  ${uiLabelMap.CommonOther}:

${uiLabelMap.ProductActionForRule} ${(productPromoRule.productPromoRuleId)?if_exists} : <#assign actionClass = "2"> <#list productPromoActions as productPromoAction> alternate-row"> <#-- toggle the row color --> <#if actionClass == "2"> <#assign actionClass = "1"> <#else> <#assign actionClass = "2">
${uiLabelMap.ProductAction} ${(productPromoAction.productPromoActionSeqId)?if_exists}
${uiLabelMap.ProductQuantity}:  ${uiLabelMap.ProductAmount}:  ${uiLabelMap.ProductItemId}:  ${uiLabelMap.PartyParty}: 
${uiLabelMap.ProductServiceName}:  ${uiLabelMap.UseCartQuantity}: 
${uiLabelMap.CommonDelete}
<#-- ======================= Categories ======================== -->
${uiLabelMap.ProductActionsCategoriesForAction} ${(productPromoAction.productPromoActionSeqId)?if_exists}:
<#assign actionProductPromoCategories = productPromoAction.getRelated("ProductPromoCategory")> <#if actionProductPromoCategories?has_content> <#list actionProductPromoCategories as actionProductPromoCategory> <#assign actionProductCategory = actionProductPromoCategory.getRelatedOneCache("ProductCategory")> <#assign actionApplEnumeration = actionProductPromoCategory.getRelatedOneCache("ApplEnumeration")>
${(actionProductCategory.description)?if_exists} [${actionProductPromoCategory.productCategoryId}] - ${(actionApplEnumeration.get("description",locale))?default(actionProductPromoCategory.productPromoApplEnumId)} - ${uiLabelMap.ProductSubCats}? ${actionProductPromoCategory.includeSubCategories?default("N")} - ${uiLabelMap.CommonAnd} ${uiLabelMap.CommonGroup}: ${actionProductPromoCategory.andGroupId}
${uiLabelMap.CommonDelete}
<#else>
${uiLabelMap.ProductNoActionCategories}

<@htmlTemplate.lookupField formName="createProductPromoCategoryActions" name="productCategoryId" id="productCategoryId_act" fieldFormName="LookupProductCategory"/> ${uiLabelMap.CommonAnd} ${uiLabelMap.CommonGroup}: *
<#-- ======================= Products ======================== -->
${uiLabelMap.ProductActionsProductsForAction} ${(productPromoAction.productPromoActionSeqId)?if_exists}:
<#assign actionProductPromoProducts = productPromoAction.getRelated("ProductPromoProduct")> <#if actionProductPromoProducts?has_content> <#list actionProductPromoProducts as actionProductPromoProduct> <#assign actionProduct = actionProductPromoProduct.getRelatedOneCache("Product")?if_exists> <#assign actionApplEnumeration = actionProductPromoProduct.getRelatedOneCache("ApplEnumeration")>
${(actionProduct.internalName)?if_exists} [${actionProductPromoProduct.productId}] - ${(actionApplEnumeration.get("description",locale))?default(actionProductPromoProduct.productPromoApplEnumId)}
${uiLabelMap.CommonDelete}
<#else>
${uiLabelMap.ProductNoActionProducts}
${uiLabelMap.ProductProductId}:
${uiLabelMap.CommonNew}:  ${uiLabelMap.ProductQuantity}:  ${uiLabelMap.ProductAmount}:  ${uiLabelMap.ProductItemId}:  ${uiLabelMap.PartyParty}: 
${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.getRelatedOneCache("ProductCategory")> <#assign promoApplEnumeration = promoProductPromoCategory.getRelatedOneCache("ApplEnumeration")>
${(promoProductCategory.description)?if_exists} [${promoProductPromoCategory.productCategoryId}] - ${(promoApplEnumeration.get("description",locale))?default(promoProductPromoCategory.productPromoApplEnumId)} - ${uiLabelMap.ProductSubCats}? ${promoProductPromoCategory.includeSubCategories?default("N")} - ${uiLabelMap.CommonAnd} ${uiLabelMap.CommonGroup}: ${promoProductPromoCategory.andGroupId}
${uiLabelMap.CommonDelete}
<@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.getRelatedOneCache("Product")?if_exists> <#assign promoApplEnumeration = promoProductPromoProduct.getRelatedOneCache("ApplEnumeration")>
${(promoProduct.internalName)?if_exists} [${promoProductPromoProduct.productId}] - ${(promoApplEnumeration.get("description",locale))?default(promoProductPromoProduct.productPromoApplEnumId)}
${uiLabelMap.CommonDelete}
${uiLabelMap.ProductProductId}*<@htmlTemplate.lookupField formName="createpromoproductform" name="productId" id="productId" fieldFormName="LookupProduct"/>