<?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.
-->

<!-- This document serves as an example for Compound Screen Widget feature -->
<compound-widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:sc="http://ofbiz.apache.org/Site-Conf"
                  xmlns:wf="http://ofbiz.apache.org/Widget-Form"
                  xmlns:wm="http://ofbiz.apache.org/Widget-Menu"
                  xmlns:ws="http://ofbiz.apache.org/Widget-Screen"
                  xsi:noNamespaceSchemaLocation="../../../../framework/widget/dtd/compound-widgets.xsd">

    <sc:site-conf>
        <!-- Request Mappings -->
        <sc:request-map uri="WorkEffortContactMech/Edit"><sc:security https="true" auth="true"/><sc:response name="success" type="view" value="WorkEffortContactMech/Edit"/></sc:request-map>
        <sc:request-map uri="WorkEffortContactMech/List"><sc:security https="true" auth="true"/><sc:response name="success" type="view" value="WorkEffortContactMech/List"/></sc:request-map>

        <sc:request-map uri="WorkEffortContactMech/create">
            <sc:security https="true" auth="true"/>
            <sc:event type="service" invoke="createWorkEffortContactMech"/>
            <sc:response name="success" type="request" value="json"/>
            <sc:response name="error" type="request" value="json"/>
        </sc:request-map>
        <sc:request-map uri="WorkEffortContactMech/delete">
            <sc:security https="true" auth="true"/>
            <sc:event type="service" invoke="deleteWorkEffortContactMech"/>
            <sc:response name="success" type="request" value="json"/>
            <sc:response name="error" type="request" value="json"/>
        </sc:request-map>

        <!-- View Mappings -->
        <sc:view-map name="WorkEffortContactMech/Edit" type="screen" page="component://workeffort/widget/workeffort/WorkEffortContactMechCpd.xml#AddWorkEffortContactMech"/>
        <sc:view-map name="WorkEffortContactMech/List" type="screen" page="component://workeffort/widget/workeffort/WorkEffortContactMechCpd.xml#ListWorkEffortContactMechs"/>
    </sc:site-conf>

    <ws:screens>
        <ws:screen name="ListWorkEffortContactMechs">
            <ws:section>
                <ws:actions>
                    <ws:set field="titleProperty" value="PageTitleListWorkEffortContactMech"/>
                    <ws:entity-one entity-name="WorkEffort" value-field="workEffort"/>
                    <ws:set field="workEffortId" from-field="workEffort.workEffortId"/>
                </ws:actions>
                <ws:widgets>
                    <ws:decorator-screen name="CommonEmbeddedDecorator" location="component://workeffort/widget/CommonScreens.xml">
                        <ws:decorator-section name="actions">
                            <ws:include-menu name="WorkEffortContactMechTabBar" location="component://workeffort/widget/workeffort/WorkEffortContactMechCpd.xml"/>
                        </ws:decorator-section>
                        <ws:decorator-section name="list">
                            <ws:include-grid name="ListWorkEffortContactMechs" location="component://workeffort/widget/workeffort/WorkEffortContactMechCpd.xml"/>
                        </ws:decorator-section>
                    </ws:decorator-screen>
                </ws:widgets>
            </ws:section>
        </ws:screen>
        <ws:screen name="AddWorkEffortContactMech">
            <ws:section>
                <ws:actions>
                    <ws:set field="titleProperty" value="PageTitleAddWorkEffortContactMech"/>
                </ws:actions>
                <ws:widgets>
                    <ws:decorator-screen name="CommonEmbeddedDecorator" location="component://workeffort/widget/CommonScreens.xml">
                        <ws:decorator-section name="single">
                            <ws:include-form name="AddWorkEffortContactMech" location="component://workeffort/widget/workeffort/WorkEffortContactMechCpd.xml"/>
                        </ws:decorator-section>
                    </ws:decorator-screen>
                </ws:widgets>
            </ws:section>
        </ws:screen>
    </ws:screens>

    <wm:menus>
        <wm:menu name="WorkEffortContactMechTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
            <wm:menu-item name="AddWorkEffortContactMech" title="${uiLabelMap.CommonAdd}">
                <wm:link target="WorkEffortContactMech/Edit" link-type="layered-modal">
                    <wm:parameter param-name="workEffortId"/>
                    <wm:set-callback area-target="WorkEffortContactMech/List">
                        <wm:parameter param-name="workEffortId"/>
                    </wm:set-callback>
                </wm:link>
            </wm:menu-item>
        </wm:menu>
        <wm:menu name="ListWorkEffortContactMechsInLineBar" extends="CommonInlineBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
            <wm:menu-item name="DeleteWorkEffortContactMech" title="${uiLabelMap.CommonDelete}">
                <wm:link target="WorkEffortContactMech/delete" request-confirmation="true">
                    <wm:auto-parameters-service service-name="deleteWorkEffortContactMech"/>
                    <wm:set-callback area-target="WorkEffortContactMech/List"/>
                </wm:link>
            </wm:menu-item>
        </wm:menu>
    </wm:menus>

    <wf:forms>
        <wf:grid name="ListWorkEffortContactMechs" paginate-target="WorkEffortContactMech/List"
                 extends="CommonDynamicList" extends-resource="component://common/widget/CommonForms.xml">
            <wf:actions>
                <wf:entity-and entity-name="WorkEffortContactMech">
                    <wf:field-map field-name="workEffortId" from-field="workEffortId"/>
                </wf:entity-and>
            </wf:actions>
            <wf:row-actions>
                <wf:entity-one entity-name="ContactMech" value-field="contactMech"/>
                <wf:set field="contactMechTypeId" from-field="contactMech.contactMechTypeId"/>
                <wf:entity-one entity-name="PostalAddress" value-field="postalAddress"/>
                <wf:entity-one entity-name="TelecomNumber" value-field="telecomNumber"/>
            </wf:row-actions>
            <wf:field name="workEffortId"><wf:hidden/></wf:field>
            <wf:field name="contactMechTypeId" title="${uiLabelMap.CommonType}"><wf:display-entity entity-name="ContactMechType"/></wf:field>
            <wf:field name="contactMechId" use-when="telecomNumber != null" title="${uiLabelMap.CommonDescription}"><wf:display description="${telecomNumber.contryCode} ${telecomNumber.areaCode} ${telecomNumber.contactNumber} ${telecomNumber.askForName}"/></wf:field>
            <wf:field name="contactMechId" use-when="postalAddress != null" title="${uiLabelMap.CommonDescription}"><wf:display description="${postalAddress.address1} ${postalAddress.address2} ${postalAddress.city} ${postalAddress.stateProvinceGeoId} ${postalAddress.postalCode} ${postalAddress.countryGeoId} "/></wf:field>
            <wf:field name="contactMechId" use-when="telecomNumber == null @and postalAddress == null" title="${uiLabelMap.CommonDescription}"><wf:display description="${contactMech.infoString}"/></wf:field>
            <wf:field name="comments"><wf:display/></wf:field>
            <wf:field name="menuAction" title=" ">
                <wf:include-menu name="ListWorkEffortContactMechsInLineBar" location="component://workeffort/widget/workeffort/WorkEffortContactMechCpd.xml"/>
            </wf:field>
        </wf:grid>

        <wf:form name="AddWorkEffortContactMech" target="WorkEffortContactMech/create"
                 focus-field-name="contactMechId"
                 extends="CommonBasicSingle" extends-resource="component://common/widget/CommonForms.xml">
            <wf:field name="workEffortId"><wf:hidden/></wf:field>
            <wf:field name="contactMechId"><wf:lookup target-form-name="LookupContactMech"/></wf:field>
            <wf:field name="comments"><wf:text size="50"/></wf:field>
            <wf:field name="addButton"><wf:submit/></wf:field>
        </wf:form>
    </wf:forms>

</compound-widgets>