ilscipio/scipio-erp

View on GitHub
applications/marketing/widget/sfa/OpportunityScreens.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="FindSalesOpportunity">
        <section>
            <actions>
                <set field="titleProperty" value="SfaFindOpportunities"/>
                <set field="activeSubMenuItem" value="Opportunities"/>
                <set field="findScreenShowResults" value="true"/> <!-- Always display results -->
            </actions>
            <widgets>
                <!-- <decorator-screen name="CommonSfaAppDecorator" location="${parameters.mainDecoratorLocation}"> --> 
                <decorator-screen name="CommonOpportunityDecorator" location="component://marketing/widget/sfa/CommonScreens.xml">            
                    <decorator-section name="body">
                        <container><link target="EditSalesOpportunity" text="${uiLabelMap.CommonCreateNew}" style="${styles.link_nav} ${styles.action_add}"/></container>
                        <decorator-screen name="FindScreenDecorator" location="component://common/widget/CommonScreens.xml">
                            <decorator-section name="search-options">
                                <include-form name="FindSalesOpportunity" location="component://marketing/widget/sfa/forms/OpportunityForms.xml"/>
                            </decorator-section>                                        
                            <decorator-section name="search-results">                                        
                                <include-form name="ListSalesOpportunity" location="component://marketing/widget/sfa/forms/OpportunityForms.xml"/>                                        
                            </decorator-section>
                        </decorator-screen>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="EditSalesOpportunity">
        <section>
            <actions>
                <set field="titleProperty" value="SfaEditOpportunity"/>
                <set field="activeSubMenuItem" value="EditSalesOpportunity"/>
                <set field="salesOpportunityId" from-field="parameters.salesOpportunityId"/>
                <entity-one entity-name="SalesOpportunity" value-field="salesOpportunity"/>
                <service service-name="findPartyInSalesOpportunityRole" result-map="accountPartyResult">
                    <field-map field-name="salesOpportunityId" from-field="parameters.salesOpportunityId"/>
                    <field-map field-name="roleTypeId" value="ACCOUNT"/>
                </service>
                <service service-name="findPartyInSalesOpportunityRole" result-map="leadPartyResult">
                    <field-map field-name="salesOpportunityId" from-field="parameters.salesOpportunityId"/>
                    <field-map field-name="roleTypeId" value="LEAD"/>
                </service>
                <set field="leadPartyId" from-field="leadPartyResult.partyId"/>
                <entity-one entity-name="CommunicationEvent" value-field="communicationEvent"/>
                <entity-and entity-name="PartyRelationshipAndDetail" list="partyAccount">
                    <field-map field-name="partyIdTo" from-field="communicationEvent.partyIdFrom"/>
                    <field-map field-name="roleTypeIdFrom" value="ACCOUNT"/>
                    <field-map field-name="roleTypeIdTo" value="CONTACT"/>
                </entity-and>
                <set field="accountPartyId" from-field="accountPartyResult.partyId"  default-value="${partyAccount[0].partyIdFrom}"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonOpportunityDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet>
                            <include-form name="EditSalesOpportunity" location="component://marketing/widget/sfa/forms/OpportunityForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="ViewSalesOpportunity">
        <section>
            <actions>
                <set field="titleProperty" value="SfaOpportunityInfo"/>
                <set field="activeSubMenuItem" value="ViewSalesOpportunity"/>
                <set field="salesOpportunityId" from-field="parameters.salesOpportunityId"/>
                <entity-one entity-name="SalesOpportunity" value-field="salesOpportunity"/>
                <service service-name="findPartyInSalesOpportunityRole" result-map="accountPartyResult">
                    <field-map field-name="salesOpportunityId" from-field="parameters.salesOpportunityId"/>
                    <field-map field-name="roleTypeId" value="ACCOUNT"/>
                </service>
                <set field="accountParty.accountPartyId" from-field="accountPartyResult.partyId"/>
                <service service-name="findPartyInSalesOpportunityRole" result-map="leadPartyResult">
                    <field-map field-name="salesOpportunityId" from-field="parameters.salesOpportunityId"/>
                    <field-map field-name="roleTypeId" value="LEAD"/>
                </service>
                <set field="leadParty.leadPartyId" from-field="leadPartyResult.partyId"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonOpportunityDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet>
                            <include-form name="ViewSalesOpportunity" location="component://marketing/widget/sfa/forms/OpportunityForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    
    <screen name="OpportunityCommEvent">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleListCommunications"/>
                <set field="activeSubMenuItem" value="PartyCommEvents"/>
                <set field="activeSubMenu2Item" value="CommunicationEvent"/>
                <set field="salesOpportunityId" from-field="parameters.salesOpportunityId"/>
                <service service-name="findPartyInSalesOpportunityRole" result-map="leadPartyResult">
                    <field-map field-name="salesOpportunityId" from-field="parameters.salesOpportunityId"/>
                    <field-map field-name="roleTypeId" value="LEAD"/>
                </service>
                <set field="partyId" from-field="leadPartyResult.partyId" default-value="${parameters.partyId}"/>
                <entity-and entity-name="Party" list="partyperson">
                    <field-map field-name="partyId" from-field="partyId"/>
                    <field-map field-name="partyTypeId" value="PERSON"/>
                </entity-and>
                <entity-condition entity-name="CommunicationEventAndRole" list="commEvents">
                    <condition-expr field-name="partyId" operator="equals" value="${partyId}"/>
                    <order-by field-name="-entryDate"/>
                </entity-condition>
                <entity-and entity-name="PartyRelationship" list="contacts" filter-by-date="true">
                    <field-map field-name="partyIdFrom" from-field="partyId"/>
                    <field-map field-name="roleTypeIdFrom" value="ACCOUNT"/>
                    <field-map field-name="roleTypeIdTo" value="CONTACT"/>
                    <order-by field-name="partyIdTo"/>
                </entity-and>
            </actions>
            <widgets>
                <decorator-screen name="CommonOpportunityDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <include-menu location="component://party/widget/partymgr/PartyMenus.xml" name="CommEventTabBar"/>
                        <include-menu location="component://party/widget/partymgr/PartyMenus.xml" name="CommSubTabBar"/>
                        <screenlet title="${uiLabelMap.PageTitleListCommunications} ${partyId}">
                            <include-form location="component://party/widget/partymgr/CommunicationEventForms.xml" name="ListCommEvents"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
</screens>