ilscipio/scipio-erp

View on GitHub
applications/product/widget/catalog/PromoScreens.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is subject to the terms and conditions defined in the
files 'LICENSE' and 'NOTICE', which are part of this source
code package.
-->

<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">
    <screen name="FindProductPromo">
        <section>
            <actions>
                <set field="titleProperty" value="ProductFindProductPromo"/>
                <set field="activeSubMenuItem" value="FindProductPromo" global="true"/>

                <set field="userEntered" from-field="parameters.userEntered"/>
                <entity-condition entity-name="ProductPromo" list="productPromos">
                    <condition-expr field-name="userEntered" from-field="userEntered" ignore-if-empty="true"/>
                    <order-by field-name="-createdDate"/>
                </entity-condition>
            </actions>
            <widgets>
                <decorator-screen name="CommonPromoDecorator" location="component://product/widget/catalog/CommonScreens.xml">
                    <decorator-section name="body">
                        <container style="${styles.grid_row}">
                            <container style="${styles.grid_large}8 ${styles.grid_cell}">
                                <screenlet title="${uiLabelMap.ProductProductPromotionsList}">
                                    <include-form name="ListProductPromos" location="component://product/widget/catalog/PromoForms.xml"/>
                                </screenlet>
                            </container>
                            <container style="${styles.grid_large}4 ${styles.grid_cell}">
                                <screenlet title="${uiLabelMap.PageTitleEditProductPromotionCode}">
                                    <include-form name="GoToProductPromoCode" location="component://product/widget/catalog/PromoForms.xml"/>
                                </screenlet>
                            </container>
                        </container>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditProductPromo">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditProductPromos"/>
                <!-- SCIPIO: if not editing existing, the find one is selected, which has same label
                <set field="activeSubMenuItem" value="EditProductPromo"/>-->
                <set field="productPromoId" from-field="parameters.productPromoId"/>
                <entity-one entity-name="ProductPromo" value-field="productPromo" auto-field-map="true"/>
                <set field="isCreateProductPromo" type="Boolean" value="${groovy: !(context.productPromo || (parameters.productPromoId &amp;&amp; parameters.isCreate != 'true'))}"/>
                <set field="labelTitleProperty" value="${groovy: isCreateProductPromo ? 'ProductNewPromotion' : 'ProductPromotion'}"/>
                <set field="activeSubMenuItem" value="${groovy: context.productPromoId ? 'EditProductPromo' : 'FindProductPromo'}"/>                
            </actions>
            <widgets>
                <decorator-screen name="CommonPromoDecorator" location="component://product/widget/catalog/CommonScreens.xml">
                    <decorator-section name="body">
                        <screenlet>
                            <include-form name="EditProductPromo" location="component://product/widget/catalog/PromoForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditProductPromoRules">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditProductPromoRules"/>
                <set field="activeSubMenuItem" value="EditProductPromoRules"/>
                <set field="labelTitleProperty" value="ProductPromotionRules"/><!-- ProductRules -->

                <property-map resource="OrderUiLabels" map-name="uiLabelMap"/>
                <set field="productPromoId" from-field="parameters.productPromoId"/>
                <entity-one entity-name="ProductPromo" value-field="productPromo" auto-field-map="true"/>

                <!-- Data Related to the Promo -->
                <entity-condition entity-name="ProductPromoRule" list="productPromoRules">
                    <condition-expr field-name="productPromoId" from-field="productPromoId"/>
                    <order-by field-name="ruleName"/>
                </entity-condition>
                <entity-condition entity-name="ProductPromoCategory" list="promoProductPromoCategories">
                    <condition-list>
                        <condition-expr field-name="productPromoId" from-field="productPromoId"/>
                        <condition-expr field-name="productPromoRuleId" value="_NA_"/>
                        <condition-expr field-name="productPromoActionSeqId" value="_NA_"/>
                        <condition-expr field-name="productPromoCondSeqId" value="_NA_"/>
                    </condition-list>
                </entity-condition>
                <entity-condition entity-name="ProductPromoProduct" list="promoProductPromoProducts">
                    <condition-list>
                        <condition-expr field-name="productPromoId" from-field="productPromoId"/>
                        <condition-expr field-name="productPromoRuleId" value="_NA_"/>
                        <condition-expr field-name="productPromoActionSeqId" value="_NA_"/>
                        <condition-expr field-name="productPromoCondSeqId" value="_NA_"/>
                    </condition-list>
                </entity-condition>

                <!-- General Data for Drop-downs, etc -->
                <entity-condition entity-name="Enumeration" list="inputParamEnums" use-cache="true">
                    <condition-expr field-name="enumTypeId" value="PROD_PROMO_IN_PARAM"/>
                    <order-by field-name="sequenceId"/>
                </entity-condition>
                <entity-condition entity-name="CarrierShipmentMethod" list="carrierShipmentMethods" use-cache="true">
                    <order-by field-name="shipmentMethodTypeId"/>
                </entity-condition>
                <entity-condition entity-name="Enumeration" list="condOperEnums" use-cache="true">
                    <condition-expr field-name="enumTypeId" value="PROD_PROMO_COND"/>
                    <order-by field-name="sequenceId"/>
                </entity-condition>
                <entity-condition entity-name="Enumeration" list="productPromoActionEnums" use-cache="true">
                    <condition-expr field-name="enumTypeId" value="PROD_PROMO_ACTION"/>
                    <order-by field-name="sequenceId"/>
                </entity-condition>
                <entity-condition entity-name="Enumeration" list="productPromoApplEnums" use-cache="true">
                    <condition-expr field-name="enumTypeId" value="PROD_PROMO_PCAPPL"/>
                    <order-by field-name="sequenceId"/>
                </entity-condition>

                <entity-condition entity-name="OrderAdjustmentType" list="orderAdjustmentTypes" use-cache="true">
                    <order-by field-name="description"/>
                </entity-condition>
                <entity-condition entity-name="ProductCategory" list="productCategories">
                    <condition-expr field-name="showInSelect" operator="not-equals" value="N"/>
                    <order-by field-name="description"/>
                </entity-condition>
            </actions>
            <widgets>
                <decorator-screen name="CommonPromoDecorator" location="component://product/widget/catalog/CommonScreens.xml">
                    <decorator-section name="body">
                        <platform-specific>
                            <html><html-template location="component://product/webapp/catalog/promo/EditProductPromoRules.ftl"/></html>
                        </platform-specific>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditProductPromoStores">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditProductPromoStores"/>
                <set field="activeSubMenuItem" value="EditProductPromoStores"/>
                <set field="labelTitleProperty" value="ProductPromotionStores"/><!-- ProductStores -->

                <set field="productPromoId" from-field="parameters.productPromoId"/>
                <entity-one entity-name="ProductPromo" value-field="productPromo" auto-field-map="true"/>
                <entity-condition entity-name="ProductStorePromoAppl" list="productStorePromoAppls">
                    <condition-expr field-name="productPromoId" from-field="productPromoId"/>
                    <order-by field-name="sequenceNum"/>
                    <order-by field-name="productPromoId"/>
                </entity-condition>

                <entity-condition entity-name="ProductStore" list="productStores">
                    <order-by field-name="storeName"/>
                </entity-condition>
            </actions>
            <widgets>
                <decorator-screen name="CommonPromoDecorator" location="component://product/widget/catalog/CommonScreens.xml">
                    <decorator-section name="body">
                        <platform-specific>
                            <html><html-template location="component://product/webapp/catalog/promo/EditProductPromoStores.ftl"/></html>
                        </platform-specific>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="FindProductPromoCode">
        <section>
            <actions>
                <set field="titleProperty" value="ProductFindPromotionCode"/><!-- ProductPromotionCode -->
                <set field="productPromoId" from-field="parameters.productPromoId"/>
                <entity-one entity-name="ProductPromo" value-field="productPromo" auto-field-map="true"/>

                <set field="manualOnly" from-field="parameters.manualOnly" default-value="Y"/>
                <entity-condition entity-name="ProductPromoCode" list="productPromoCodes">
                    <condition-list combine="and">
                        <condition-expr field-name="productPromoId" from-field="productPromoId"/>
                    </condition-list>
                    <order-by field-name="-createdDate"/>
                </entity-condition>
            </actions>
            <widgets>
                <decorator-screen name="CommonPromoCodeDecorator" location="component://product/widget/catalog/CommonScreens.xml">
                    <decorator-section name="body">  
                        <platform-specific>
                            <html><html-template location="component://product/webapp/catalog/promo/FindProductPromoCode.ftl"/></html>
                        </platform-specific>
                        <section>
                            <condition>
                                <not>
                                    <if-empty field="productPromoCodes"/>
                                </not>
                            </condition>
                            <widgets>
                                <screenlet title="${uiLabelMap.ProductPromotionCodes}">
                                    <include-form name="ListProductPromoCodes" location="component://product/widget/catalog/PromoForms.xml"/>
                                </screenlet>
                            </widgets>
                            <fail-widgets>
                                <section>
                                    <actions>
                                        <entity-condition entity-name="ProductPromoCode" list="productPromoCodes">
                                            <!-- TODO?: what was this for?
                                            <condition-list combine="and">
                                            </condition-list>  -->
                                            <order-by field-name="-createdDate"/>
                                        </entity-condition>
                                    </actions>
                                    <widgets>
                                        <screenlet title="${uiLabelMap.ProductPromotionCodes}">
                                            <include-form name="ListProductPromoCodes" location="component://product/widget/catalog/PromoForms.xml"/>
                                        </screenlet>
                                    </widgets>
                                </section>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditProductPromoCode">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditProductPromotionCode"/>
                
                <set field="productPromoCodeId" from-field="parameters.productPromoCodeId" />
                <entity-one entity-name="ProductPromoCode" value-field="productPromoCode"/>
                
                <set field="usePromoCodeTitle" type="Boolean" value="true"/>
                
                <set field="isCreateProductPromoCode" type="Boolean" value="${groovy: !(context.productPromoCode || (parameters.productPromoCodeId &amp;&amp; parameters.isCreate != 'true'))}"/>
                <set field="labelTitleProperty" value="${groovy: isCreateProductPromoCode ? 'ProductNewPromotionCode' : 'ProductPromotionCode'}"/>
                <script location="component://product/webapp/catalog/WEB-INF/actions/promo/EditProductPromoCode.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonPromoCodeDecorator" location="component://product/widget/catalog/CommonScreens.xml">
                    <decorator-section name="body">
                        <include-menu name="PromoCodeSubTabBar" location="component://product/widget/catalog/CatalogMenus.xml" />
                        <screenlet><!--  title="${uiLabelMap.PageTitleEditProductPromotionCode}" -->
                            <include-form name="EditProductPromoCode" location="component://product/widget/catalog/PromoForms.xml"/>
                        </screenlet>
                        <platform-specific>
                            <html><html-template location="component://product/webapp/catalog/promo/EditProductPromoCode.ftl"/></html>
                        </platform-specific>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="EditProductPromoContent">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditProductPromoContent"/>
                <set field="activeSubMenuItem" value="EditProductPromoContent"/>
                <set field="labelTitleProperty" value="ProductPromotionContent"/><!-- ProductPromoContents -->
                <set field="productPromoId" from-field="parameters.productPromoId"/>
                <set field="parameters.fromDate" type="Timestamp" from-field="parameters.fromDate"/>
                <set field="parameters.thruDate" type="Timestamp" from-field="parameters.thruDate"/>
                <entity-one entity-name="ProductPromo" value-field="productPromo"/>
                <entity-one entity-name="ProductPromoContent" value-field="productPromoContent"/>
                <entity-and entity-name="ProductPromoContent" list="productPromoContents">
                    <field-map field-name="productPromoId" from-field="productPromoId"/>
                </entity-and>
            </actions>
            <widgets>
                <decorator-screen name="CommonPromoDecorator" location="component://product/widget/catalog/CommonScreens.xml">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.PageTitleEditProductPromoContent}">
                            <include-form name="EditProductPromoContentImage" location="component://product/widget/catalog/PromoForms.xml"/>
                        </screenlet>
                        <screenlet title="${uiLabelMap.ProductProductPromoContentList}">
                            <include-form name="ListProductPromoContent" location="component://product/widget/catalog/PromoForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
</screens>