ilscipio/scipio-erp

View on GitHub
applications/commonext/widget/ofbizsetup/SetupScreens.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<!--
    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.
-->

<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">
    
    <screen name="InitialSetup">
        <section>
            <actions>
                <set field="activeSubMenuItemTop" value="organization"/>
                <set field="titleProperty" value="SetupCreateNewOrganization"/>
                <set field="target" value="createOrganization"/>
                <set field="previousParams" from-field="_PREVIOUS_PARAMS_" from-scope="user"/>
                <property-to-field field="defaultCountryGeoId" resource="general" property="country.geo.id.default" default="USA"/>
                <entity-condition entity-name="PartyRole" list="parties">
                    <condition-expr field-name="roleTypeId" operator="equals" value="INTERNAL_ORGANIZATIO"/>
                </entity-condition>
                <set field="partyId" from-field="parties[0].partyId"/>
                <set field="parameters.partyId" from-field="parties[0].partyId"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonSetupDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-empty field="parties"/>
                            </condition>
                            <widgets>
                                <section>
                                    <actions>
                                        <!-- fields for setDependentDropdownValuesJs.ftl, it's a try on generalization, if you need an example with more than one dropdown in a form have a look at EditProductPriceRules screen -->
                                        <set field="dependentForm" value="NewOrganization"/>
                                        <set field="paramKey" value="countryGeoId"/>                                        
                                        <set field="mainId" value="USER_COUNTRY"/>
                                        <set field="dependentId" value="USER_STATE"/>
                                        <set field="requestName" value="getAssociatedStateList"/>
                                        <set field="responseName" value="stateList"/>
                                        <set field="dependentKeyName" value="geoId"/>
                                        <set field="descName" value="geoName"/>
                                        <set field="selectedDependentOption" value="_none_"/>
                                    </actions>
                                    <widgets>
                                        <platform-specific><html><html-template location="component://common/webcommon/includes/setDependentDropdownValuesJs.ftl"/></html></platform-specific>
                                        <screenlet>
                                            <include-form name="NewOrganization" location="component://commonext/widget/ofbizsetup/SetupForms.xml"/>
                                        </screenlet>
                                    </widgets>
                                </section>
                            </widgets>
                            <fail-widgets>
                                <include-screen name="viewprofile" location="component://commonext/widget/ofbizsetup/ProfileScreens.xml"/> 
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="EditFacility">
        <section>
            <actions>
                <set field="titleProperty" value="ProductNewFacility"/>
                <set field="activeSubMenuItemTop" value="facility"/>
                <set field="partyId" from-field="parameters.partyId"/>
                <script location="component://commonext/webapp/ofbizsetup/WEB-INF/actions/FindFacility.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonSetupDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-service-permission service-name="facilityGenericPermission" main-action="VIEW"/>
                            </condition>
                            <widgets>
                                <section>
                                    <condition>
                                        <not><if-empty field="facility"/></not>
                                    </condition>
                                    <widgets>
                                        <label style="heading" text="${uiLabelMap.ProductEditFacility} ${facility.facilityName} [${facility.facilityId}]"></label>
                                    </widgets>
                                    <fail-widgets>
                                        <label style="heading" text="${uiLabelMap.ProductNewFacility}"></label>
                                    </fail-widgets>
                                </section>
                                <include-form name="EditFacility" location="component://commonext/widget/ofbizsetup/SetupForms.xml"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error-perm">${uiLabelMap.ProductFacilityViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="EditProductStore">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditProductStore"/>
                <set field="activeSubMenuItemTop" value="productstore"/>
                <set field="labelTitleProperty" value="PageTitleEditProductStore"/>
                
                <set field="partyId" from-field="parameters.partyId"/>
                <entity-one entity-name="PartyGroup" value-field="partyGroup"/>
                <property-to-field field="defaultCurrencyUomId" resource="general" property="currency.uom.id.default" default="USD"/>
                <script location="component://commonext/webapp/ofbizsetup/WEB-INF/actions/GetProductStoreAndWebSite.groovy"/>
                <script location="component://commonext/webapp/ofbizsetup/WEB-INF/actions/FindFacility.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonSetupDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-compare field="showScreen" operator="equals" value="origin"/>
                            </condition>
                            <widgets>
                                <section>
                                    <condition><not><if-empty field="productStoreId"/></not></condition>
                                    <widgets>
                                        <label style="heading" text="${uiLabelMap.PageTitleEditProductStore} ${uiLabelMap.CommonFor}: ${productStore.storeName} [${productStoreId}]"/>
                                    </widgets>
                                </section>
                                <screenlet title="${uiLabelMap.SetupEditProductStore}">
                                    <include-form name="EditProductStore" location="component://commonext/widget/ofbizsetup/SetupForms.xml"/>
                                </screenlet>
                            </widgets>
                            <fail-widgets>
                                <section>
                                    <condition>
                                        <if-compare field="showScreen" operator="equals" value="message"/>
                                    </condition>
                                    <widgets>
                                        <label style="common-msg-error">${uiLabelMap.SetupPageError}</label>
                                    </widgets>
                                </section>
                            </fail-widgets>
                        </section>
                        
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="EditWebSite">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditWebSite"/>
                <set field="activeSubMenuItemTop" value="website"/>
                <set field="labelTitleProperty" value="PageTitleEditWebSite"/>
                <set field="partyId" from-field="parameters.partyId"/>
                <script location="component://commonext/webapp/ofbizsetup/WEB-INF/actions/GetProductStoreAndWebSite.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonSetupDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-compare field="showScreen" operator="equals" value="origin"/>
                            </condition>
                            <widgets>
                                <section>
                                    <condition><not><if-empty field="webSite"/></not></condition>
                                    <widgets>
                                        <label style="heading" text="${uiLabelMap.PageTitleEditWebSite} ${uiLabelMap.CommonFor}: ${webSite.siteName} [${webSite.webSiteId}]"/>
                                    </widgets>
                                </section>
                                <section>
                                    <widgets>
                                        <screenlet>
                                            <include-form name="EditWebSite" location="component://commonext/widget/ofbizsetup/SetupForms.xml"/>
                                        </screenlet>
                                    </widgets>
                                </section>
                            </widgets>
                            <fail-widgets>
                                <section>
                                    <condition>
                                        <if-compare field="showScreen" operator="equals" value="message"/>
                                    </condition>
                                    <widgets>
                                        <label style="common-msg-error">${uiLabelMap.SetupPageError}</label>
                                    </widgets>
                                </section>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <!-- First Product -->
    <screen name="EditProdCatalog">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditProductCatalog"/>
                <set field="activeSubMenuItem" value="productcatalog"/>
                <set field="partyId" from-field="parameters.partyId"/>
                <script location="component://commonext/webapp/ofbizsetup/WEB-INF/actions/GetProdCatalog.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonFirstProductDecorator">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-compare field="showScreen" operator="equals" value="origin"/>
                            </condition>
                            <widgets>
                                <label style="heading">${uiLabelMap.ProductCatalog} ${uiLabelMap.CommonFor} "${prodCatalog.catalogName}" [${prodCatalogId}]</label>
                                <screenlet>
                                    <include-form name="EditProdCatalog" location="component://commonext/widget/ofbizsetup/SetupForms.xml"/>
                                </screenlet>
                            </widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="EditCategory">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditProductCategories"/>

                <set field="activeSubMenuItem" value="productcategory"/>
                <set field="labelTitleProperty" value="ProductCategory"/>

                <set field="partyId" from-field="parameters.partyId"/>
                <script location="component://commonext/webapp/ofbizsetup/WEB-INF/actions/GetProdCatalog.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonFirstProductDecorator">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-compare field="showErrorMsg" operator="equals" value="N"/>
                            </condition>
                            <widgets>
                                <label style="heading">${uiLabelMap[labelTitleProperty]} ${uiLabelMap.CommonFor}: ${productCategory.description} [${productCategoryId}]  ${${extraFunctionName}}</label>
                                <screenlet name="CreateProductCategory" title="${uiLabelMap.PageTitleEditProductCategory}">
                                    <include-form name="EditProductCategory" location="component://commonext/widget/ofbizsetup/SetupForms.xml"/>
                                </screenlet>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error">${uiLabelMap.SetupPageError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="EditProduct">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleEditProduct"/>
                <set field="activeSubMenuItem" value="product"/>
                <set field="labelTitleProperty" value="ProductProduct"/>
                
                <set field="partyId" from-field="parameters.partyId"/>           
                <script location="component://commonext/webapp/ofbizsetup/WEB-INF/actions/GetProdCatalog.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonFirstProductDecorator">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-compare field="showErrorMsg" operator="equals" value="N"/>
                            </condition>
                            <widgets>
                                <container>
                                    <label style="heading">${uiLabelMap[labelTitleProperty]} ${uiLabelMap.CommonFor}: ${product.internalName} [${productId}]  ${${extraFunctionName}}</label>
                                </container>
                                <include-form name="EditProduct" location="component://commonext/widget/ofbizsetup/SetupForms.xml"/>
                            </widgets>
                            <fail-widgets>
                                <label style="common-msg-error">${uiLabelMap.SetupPageError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="CommonFirstProductDecorator">
        <section>
            <actions>
                <set field="activeSubMenuItemTop" from-field="activeSubMenuItemTop" default-value="firstproduct"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonSetupDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <or>
                                    <and>
                                        <not><if-empty field="showScreen"/></not>
                                        <if-compare field="showScreen" operator="equals" value="origin"/>
                                    </and>
                                    <not><if-empty field="showErrorMsg"/></not>
                                </or>      
                            </condition>
                            <widgets>
                                <include-menu name="FirstProductTabBar" location="component://commonext/widget/ofbizsetup/Menus.xml"/>
                            </widgets>
                        </section>
                        <decorator-section-include name="body"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="nopartyAcctgPreference">
        <section>
            <actions>
                <set field="titleProperty" value="SetupCreateNewOrganization"/>
                <set field="activeSubMenuItem" value="init"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonSetupAppDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <label style="errorMessage">${uiLabelMap.SetupEventMessage}</label>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
</screens>