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

<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">

     <form name="EditMarketingCampaign" type="single" target="updateMarketingCampaign" title="" default-map-name="marketingCampaign">
        <actions>
            <property-to-field field="defaultCurrencyUomId" resource="general" property="currency.uom.id.default" default="USD"/>
        </actions>
        <alt-target use-when="marketingCampaign==null" target="createMarketingCampaign"/>
        <auto-fields-entity entity-name="MarketingCampaign"/>
        <field use-when="marketingCampaign!=null" name="marketingCampaignId" title="${uiLabelMap.MarketingCampaignId}"><display/></field>
        <field use-when="marketingCampaign==null&amp;&amp;marketingCampaignId==null" name="marketingCampaignId" title="${uiLabelMap.MarketingCampaignId}"><ignored/></field>
        <field use-when="marketingCampaign==null&amp;&amp;marketingCampaignId!=null" name="marketingCampaignId" title="${uiLabelMap.MarketingCampaignId}" tooltip="${uiLabelMap.CommonCannotBeFound}: [${marketingCampaignId}]"><display/></field>
        <field name="parentCampaignId" title="${uiLabelMap.MarketingParentCampaignId}">
            <drop-down allow-empty="true">
                <entity-options description="${campaignName}" entity-name="MarketingCampaign" key-field-name="marketingCampaignId">
                </entity-options>
            </drop-down>
        </field>
        <field name="campaignName" title="${uiLabelMap.MarketingCampaignName}"><text size="55"/></field>
        <field name="campaignSummary" title="${uiLabelMap.MarketingCampaignSummary}">
            <textarea rows="5"/>
        </field>
        <field name="statusId" title="${uiLabelMap.CommonStatus}">
            <drop-down allow-empty="false">
                <entity-options entity-name="StatusItem">
                     <entity-constraint name="statusTypeId" value="MKTG_CAMP_STATUS"/>
                     <entity-order-by field-name="sequenceId"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="currencyUomId" title="${uiLabelMap.CommonCurrency}">
            <drop-down allow-empty="false" no-current-selected-key="${defaultOrganizationPartyCurrencyUomId}">
                <entity-options key-field-name="uomId" description="${description} - ${abbreviation}" entity-name="Uom">
                    <entity-constraint name="uomTypeId" operator="equals" value="CURRENCY_MEASURE"/>
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="DONE_PAGE">
            <hidden value="${donePage}"/>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonSave}" widget-style="buttontext"><submit button-type="text-link"/></field>
        <field name="cancelLink" widget-style="buttontext" title=" "><hyperlink description="${uiLabelMap.CommonCancelDone}" target="${donePage}" also-hidden="false" target-type="inter-app"/></field>
    </form>

   <form name="ListMarketingCampaign" type="list" paginate-target="FindMarketingCampaign"
        odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
        <actions>
            <entity-condition entity-name="MarketingCampaign"/>
        </actions>
        <field name="marketingCampaignId" widget-style="buttontext" title="${uiLabelMap.MarketingCampaignId}">
            <hyperlink description="${marketingCampaignId}" target="EditMarketingCampaign" also-hidden="false">
                <parameter param-name="marketingCampaignId"/>
            </hyperlink>
        </field>
        <field name="campaignName" title="${uiLabelMap.MarketingCampaignName}"><display/></field>
        <field name="statusId" title="${uiLabelMap.CommonStatus}">
            <display-entity entity-name="StatusItem" also-hidden="true"/>
        </field>
        <field name="parentCampaignId" title="${uiLabelMap.MarketingParentCampaignId}"><display/></field>
    </form>

   <form name="ListMarketingCampaignRoles" type="list" paginate-target="listMarketingCampaignGeo"
        odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
        <actions>
        <entity-and entity-name="MarketingCampaignRole">
            <field-map field-name="marketingCampaignId" from-field="marketingCampaignId"/>
        </entity-and>
        </actions>
        <field name="marketingCampaignId" title="${uiLabelMap.MarketingCampaignId}">
            <display/>
        </field>
        <field name="partyId" title="${uiLabelMap.PartyPartyId}" use-when="&quot;${lastName}&quot;!=null">
            <display-entity entity-name="PartyNameView" description="${firstName} ${lastName}" also-hidden="true">
                <sub-hyperlink target="/partymgr/control/viewprofile" description="${partyId}" link-style="buttontext" target-type="inter-app">
                    <parameter param-name="partyId"/>
                </sub-hyperlink>
            </display-entity>
        </field>
<!-- Currently not working for PartyGroup
        <field name="partyId" title="${uiLabelMap.PartyPartyId}" use-when="&quot;${groupName}&quot;!=null">
            <display-entity entity-name="PartyNameView" description="${groupName}" also-hidden="true">
                <sub-hyperlink target="/partymgr/control/viewProfile" description="${partyId}" link-style="buttontext">
                    <parameter param-name="partyId"/>
                </sub-hyperlink>
            </display-entity>
        </field>
        -->
        <field name="roleTypeId" title="${uiLabelMap.PartyRoleTypeId}">
            <display-entity entity-name="RoleType" also-hidden="true"/>
                <!--<sub-hyperlink target="/partymgr/control/viewProfile" description="${partyId}" link-style="buttontext">
                    <parameter param-name="partyId"/>
                </sub-hyperlink>
            </display-entity>-->
        </field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonDelete}" target="removeMarketingCampaignRole" also-hidden="false">
                <parameter param-name="marketingCampaignId"/>
                <parameter param-name="roleTypeId"/>
                <parameter param-name="partyId"/>
            </hyperlink>
        </field>
    </form>

    <form name="EditMarketingCampaignRoles" type="single" target="createMarketingCampaignRole" title="" default-map-name="marketingCampaignRole"
        header-row-style="header-row" default-table-style="basic-table">
        <auto-fields-service service-name="createMarketingCampaignRole"/>
        <field use-when="marketingCampaign!=null" name="marketingCampaignId" title="${uiLabelMap.MarketingCampaignId}"><display/></field>
        <field use-when="marketingCampaign==null&amp;&amp;marketingCampaignId==null" name="marketingCampaignId" title="${uiLabelMap.MarketingCampaignId}"><ignored/></field>
        <field use-when="marketingCampaign==null&amp;&amp;marketingCampaignId!=null" name="marketingCampaignId" title="${uiLabelMap.MarketingCampaignId}" tooltip="${uiLabelMap.CommonCannotBeFound}: [${marketingCampaignId}]"><display/></field>
        <field name="partyId" title="${uiLabelMap.PartyPartyId}">
            <lookup target-form-name="LookupPartyName"/>
        </field>
        <field name="roleTypeId">
            <drop-down>
                <entity-options entity-name="RoleType" key-field-name="roleTypeId">
                </entity-options>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonSave}" widget-style="buttontext"><submit button-type="text-link"/></field>
        <field name="cancelLink" widget-style="buttontext" title=" ">
            <hyperlink description="${uiLabelMap.CommonCancelDone}" target="${donePage}" also-hidden="false">
                <parameter param-name="marketingCampaignId"/>
            </hyperlink>
        </field>
    </form>
    <grid name="Campaigns" list-name="campaigns"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <row-actions>
            <set field="uomId" from-field="currencyUomId"/>
            <entity-one entity-name="Uom" value-field="currency"/>
        </row-actions>
        <field name="marketingCampaignId" title="${uiLabelMap.MarketingCampaign}">
            <hyperlink description="${marketingCampaignId} - ${campaignName}" target="EditMarketingCampaign" also-hidden="false">
                <parameter param-name="marketingCampaignId"/>
            </hyperlink>
        </field>
        <field name="statusId" title="${uiLabelMap.CommonStatus}"><display-entity entity-name="StatusItem"/></field>
        <field name="budgetedCost" widget-area-style="align-right" title-area-style="align-right"><display description="${budgetedCost} ${currency.abbreviation}"/></field>
        <field name="fromDate" title="${uiLabelMap.CommonFrom}"><display type="date"/></field>
        <field name="thruDate" title="${uiLabelMap.CommonThru}"><display type="date"/></field>
        <field name="parentCampaignId" title="${uiLabelMap.CommonParent}">
            <display-entity entity-name="MarketingCampaign" key-field-name="marketingCampaignId" description="${marketingCampaignId} - ${campaignName}"/>
        </field>
    </grid>
</forms>
