<?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="EditTrackingCode" type="single" target="updateTrackingCode" title="" default-map-name="trackingCode"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="trackingCode==null" target="createTrackingCode"/>

        <field use-when="trackingCode!=null" name="trackingCodeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeId}"><display/></field>
        <field use-when="trackingCode==null&amp;&amp;trackingCodeId==null" name="trackingCodeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeId}"><text/></field>
        <field use-when="trackingCode==null&amp;&amp;trackingCodeId!=null" name="trackingCodeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeId}" tooltip="${uiLabelMap.CommonCannotBeFound}: [${trackingCodeId}]"><display/></field>

        <field name="description" title="${uiLabelMap.MarketingTrackingCodeDescription}"><text/></field>
        <field name="comments" title="${uiLabelMap.MarketingTrackingCodeComments}"><textarea/></field>
        <field name="trackingCodeTypeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeTypeId}">
            <drop-down>
                <entity-options entity-name="TrackingCodeType" key-field-name="trackingCodeTypeId">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="marketingCampaignId" title="${uiLabelMap.MarketingCampaignId}">
            <drop-down allow-empty="true">
                <entity-options description="${campaignName}" entity-name="MarketingCampaign" key-field-name="marketingCampaignId">
                    <entity-order-by field-name="campaignName"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="prodCatalogId" title="${uiLabelMap.MarketingTrackingCodeDefaultProdCatalogId}" tooltip="${uiLabelMap.MarketingTrackingCodeNoOverrideIfEmpty}">
            <drop-down allow-empty="true">
                <entity-options description="${catalogName}" entity-name="ProdCatalog" key-field-name="prodCatalogId">
                    <entity-order-by field-name="catalogName"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="fromDate" title="${uiLabelMap.CommonFromDate}"><date-time/></field>
        <field name="thruDate" title="${uiLabelMap.CommonThruDate}"><date-time/></field>

        <field name="redirectUrl" title="${uiLabelMap.MarketingTrackingCodeRedirectUrl}" tooltip="${uiLabelMap.MarketingTrackingCodeNoRedirectIfEmpty}"><text size="40"/></field>
        <field name="overrideLogo" title="${uiLabelMap.MarketingTrackingCodeOverrideLogo}" tooltip="${uiLabelMap.MarketingTrackingCodeNoOverrideIfEmpty}"><text size="60"/></field>
        <field name="overrideCss" title="${uiLabelMap.MarketingTrackingCodeOverrideCss}" tooltip="${uiLabelMap.MarketingTrackingCodeNoOverrideIfEmpty}"><text size="60"/></field>
        <field name="trackableLifetime" title="${uiLabelMap.MarketingTrackingCodeTrackableLifetime}" tooltip="${uiLabelMap.MarketingTrackingCodeInSeconds}"><text size="10"/></field>
        <field name="billableLifetime" title="${uiLabelMap.MarketingTrackingCodeBillableLifetime}" tooltip="${uiLabelMap.MarketingTrackingCodeInSeconds}"><text size="10"/></field>
        <field name="groupId" title="${uiLabelMap.MarketingTrackingCodeGroupId}"><text size="10"/></field>
        <field name="subgroupId" title="${uiLabelMap.MarketingTrackingCodeSubgroupId}"><text size="10"/></field>

        <field name="submitButton" title="${uiLabelMap.CommonSave}" widget-style="buttontext"><submit button-type="text-link"/></field>
        <!-- <field name="DONE_PAGE"><hidden value="${donePage}"/></field> -->
        <!-- <field name="cancelLink" title=" " widget-style="buttontext"><hyperlink description="${uiLabelMap.CommonCancelDone}" target="${donePage}" also-hidden="false" target-type="inter-app"/></field> -->
    </form>

    <grid name="ListTrackingCode" target="ListTrackingCode" title=""
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <actions>
            <entity-condition entity-name="TrackingCode"/>
        </actions>
        <field name="trackingCodeId"  widget-style="buttontext" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeId}">
            <hyperlink description="${trackingCodeId}" target="EditTrackingCode" also-hidden="false">
                <parameter param-name="trackingCodeId"/>
            </hyperlink>
        </field>
        <field name="description" title="${uiLabelMap.MarketingTrackingCodeDescription}"><display/></field>
        <field name="trackingCodeTypeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeTypeId}"><display-entity entity-name="TrackingCodeType"/></field>
        <field name="marketingCampaignId" title="${uiLabelMap.MarketingCampaignId}"><display-entity description="${campaignName}" entity-name="MarketingCampaign"/></field>
        <field name="prodCatalogId"><display-entity description="${catalogName}" entity-name="ProdCatalog"/></field>

        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonDelete}" target="deleteTrackingCode" also-hidden="false">
                <parameter param-name="trackingCodeId"/>
            </hyperlink>
        </field>
    </grid>
    
    <!-- UNUSED FORM
    <form name="FindTrackingCode" type="single" target="ListTrackingCode" title=""
        header-row-style="header-row" default-table-style="basic-table">
        <auto-fields-entity entity-name="TrackingCode"/>
    </form>
    -->
    <form name="EditTrackingCodeOrder" type="single" target="updateTrackingCodeOrder" title="" default-map-name="trackingCodeOrder"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="trackingCodeOrder==null" target="createTrackingCodeOrder"/>

        <field name="trackingCodeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeId}"><display/></field>
        <field name="orderId" title="${uiLabelMap.MarketingTrackingCodeOrderOrderId}"><display/></field>
        <field name="trackingCodeTypeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeTypeId}">
            <drop-down>
                <entity-options entity-name="TrackingCodeType" key-field-name="trackingCodeTypeId">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>

        <field name="isBillable" title="${uiLabelMap.MarketingTrackingCodeOrderIsBilliable}">
            <drop-down allow-empty="true">
                <option key="Y" description="${uiLabelMap.CommonY}"/><option key="N" description="${uiLabelMap.CommonN}"/>
            </drop-down>
        </field>

        <field name="submitButton" title="${uiLabelMap.CommonSave}" widget-style="buttontext"><submit button-type="text-link"/></field>
     </form>

    <form name="FindTrackingCodeOrders" type="single" target="ListTrackingCodeOrders" title=""
        header-row-style="header-row" default-table-style="basic-table">
        <field name="trackingCodeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeId}"><text-find/></field>
        <field name="orderId" title="${uiLabelMap.MarketingTrackingCodeOrderOrderId}"><lookup target-form-name="LookupOrderName"/></field>
        <field name="trackingCodeTypeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeTypeId}">
            <drop-down>
                <entity-options entity-name="TrackingCodeType" key-field-name="trackingCodeTypeId">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>

        <field name="submitButton" title="${uiLabelMap.CommonFind}" widget-style="buttontext"><submit button-type="text-link"/></field>
    </form>
    
    <grid name="ListTrackingCodeOrders" title="" paginate-target="FindTrackingCodeOrders" list-name="listIt"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <actions>
            <service service-name="performFind" result-map="result" result-map-list="listIt">
                <field-map field-name="inputFields" from-field="parameters"/>
                <field-map field-name="orderBy" value="-orderId"/>
                <field-map field-name="entityName" value="TrackingCodeOrder"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
            </service>
        </actions>

        <field name="trackingCodeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeId}"><display/></field>
        <field name="orderId" title="${uiLabelMap.MarketingTrackingCodeOrderOrderId}"><display-entity entity-name="OrderHeader" description="${orderDate} [${orderId}]"/></field>
        <field name="trackingCodeTypeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeTypeId}"><display-entity entity-name="TrackingCodeType"/></field>
        <field name="isBillable" title="${uiLabelMap.MarketingTrackingCodeOrderIsBilliable}"><display/></field>
    </grid>

    <form name="EditTrackingCodeVisit" default-map-name="visit" target="updateTrackingCodeVisit" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target target="createTrackingCodeVisit" use-when="visit==null"/>
        <field name="tackingCodeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeId}"><display/></field>
        <field name="visitId" title="${uiLabelMap.MarketingTrackingCodeVisitVisitId}"><display/></field>
        <field name="fromDate" title="${uiLabelMap.CommonFromDate}"><display/></field>

        <field name="sourceEnumId" title="${uiLabelMap.MarketingTrackingCodeVisitSourceEnumId}">
            <drop-down>
                <entity-options entity-name="Enumeration" key-field-name="enumId">
                    <entity-constraint name="enumTypeId" operator="equals" value=" TRACKINGCODE_SRC"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonSave}"><submit button-type="button"/>        </field>
        <field name="cancelLink" title="${uiLabelMap.CommonCancel}" widget-style="buttontext"><hyperlink description="${uiLabelMap.CommonCancelDone}" target="${donePage}" also-hidden="false"/></field>
    </form>
    
    <form name="FindTrackingCodeVisits" target="ListTrackingCodeVisits" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table">
        <field name="trackingCodeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeId}"><text/></field>
        <field name="visitId" title="${uiLabelMap.MarketingTrackingCodeVisitVisitId}"><lookup target-form-name="LookupVisit"/></field>
        <field name="fromDate" title="${uiLabelMap.CommonFromDate}"><date-find/></field>
        <field name="sourceEnumId" title="${uiLabelMap.MarketingTrackingCodeVisitSourceEnumId}">
            <drop-down>
                <entity-options entity-name="Enumeration" key-field-name="enumId">
                    <entity-constraint name="enumTypeId" operator="equals" value=" TRACKINGCODE_SRC"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonFind}" widget-style="buttontext"><submit button-type="text-link"/></field>
    </form>
    <form name="ListTrackingCodeVisits" list-name="listIt" title="" paginate-target="FindTrackingCodeVisits" type="list"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <actions>
            <service result-map-list="listIt" result-map="result" service-name="performFind">
                <field-map field-name="inputFields" from-field="requestParameters"/>
                <field-map field-name="entityName" from-field="entityName"/>
                <field-map field-name="orderBy" value="-fromDate"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
            </service>
        </actions>
        <field name="visitId" title="${uiLabelMap.MarketingTrackingCodeVisitVisitId}">
            <hyperlink description="${visitId}" target="/partymgr/control/visitdetail" target-type="inter-app">
                <parameter param-name="visitId"/>
                <parameter param-name="DONE_PAGE" from-field="donePage"/>
            </hyperlink>
        </field>
        <field name="sourceEnumId" title="${uiLabelMap.MarketingTrackingCodeVisitSourceEnumId}">
            <display-entity description="${description} [${enumCode}]" entity-name="Enumeration" key-field-name="enumId"/>
        </field>
        <field name="fromDate" title="${uiLabelMap.CommonFromDate}"><display/></field>
    </form>

    <form name="LookupTrackingCode" default-map-name="trackingCode" target="LookupTrackingCode" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table">
        <field name="trackingCodeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeId}"><text-find/></field>
        <field name="description" title="${uiLabelMap.MarketingTrackingCodeDescription}"><text-find/></field>
        <field name="trackingCodeTypeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeTypeId}">
            <drop-down>
                <entity-options entity-name="TrackingCodeType" key-field-name="trackingCodeTypeId">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="prodCatalogId" title="${uiLabelMap.MarketingTrackingCodeProdCatalogId}">
            <drop-down>
                <entity-options description="${catalogName}" entity-name="ProdCatalog" key-field-name="prodCatalogId">
                    <entity-order-by field-name="catalogName"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="marketingCampaignId" title="${uiLabelMap.MarketingCampaignId}">
            <drop-down allow-empty="true">
                <entity-options description="${campaignName}" entity-name="MarketingCampaign">
                    <entity-order-by field-name="campaignName"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonSave}" widget-style="buttontext"><submit button-type="text-link"/></field>
    </form>
    <form name="ListLookupTrackingCode" target="" title="" type="list"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <actions>
            <service result-map-list="listIt" result-map="result" service-name="performFind">
                <field-map field-name="inputFields" from-field="parameters"/>
                <field-map field-name="entityName" from-field="entityName"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
            </service>
        </actions>
        <field name="trackingCodeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeId}" widget-style="buttontext">
            <hyperlink description="${trackingCodeId}" target="javascript:set_value('${trackingCodeId}')" also-hidden="false" target-type="plain"/>
        </field>
        <field name="description" title="${uiLabelMap.MarketingTrackingCodeDescription}"><display/></field>
        <field name="trackingCodeTypeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeTypeId}"><display-entity entity-name="TrackingCodeType"/></field>
        <field name="prodCatalogId" title="${uiLabelMap.MarketingTrackingCodeProdCatalogId}"><display-entity description="${catalogName}" entity-name="ProdCatalog"/></field>
        <field name="marketingCampaignId" title="${uiLabelMap.MarketingCampaignId}"><display-entity description="${campaignName}" entity-name="MarketingCampaign"/></field>
    </form>

    <form name="LookupVisit" target="LookupVisit" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table">
        <field name="visitId" title="${uiLabelMap.MarketingTrackingCodeVisitVisitId}"><text-find/></field>
        <field name="partyId" title="${uiLabelMap.MarketingTrackingCodeVisitPartyId}"><lookup target-form-name="LookupPartyName"/></field>
        <field name="fromDate" title="${uiLabelMap.CommonFromDate}"><date-find/></field>
        <field name="thruDate" title="${uiLabelMap.CommonThruDate}"><date-find/></field>
        <field name="submitButton" title="${uiLabelMap.CommonFind}"><submit button-type="button"/></field>
    </form>
    
    <grid name="ListLookupVisit" target="" title=""
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <actions>
            <service result-map-list="listIt" result-map="result" service-name="performFind">
                <field-map field-name="inputFields" from-field="parameters"/>
                <field-map field-name="entityName" from-field="entityName"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
            </service>
        </actions>
        <field name="visitId" title="${uiLabelMap.MarketingTrackingCodeVisitVisitId}" widget-style="buttontext">
            <hyperlink description="${visitId}" target="javascript:set_value('${visitId}')" also-hidden="false" target-type="plain"/>
        </field>
        <field name="partyId" title="${uiLabelMap.MarketingTrackingCodeVisitPartyId}">
            <display-entity description="${partyId}" entity-name="Party" key-field-name="partyId"/>
        </field>
        <field name="visitorId" title="${uiLabelMap.MarketingTrackingCodeVisitVisitorId}">
            <display-entity description="${partyId} ${userLoginId} [${visitorId}]" entity-name="Visitor" key-field-name="visitorId"/>
        </field>
        <field name="contactMechTypeId" title="${uiLabelMap.MarketingTrackingCodeVisitContactMechTypeId}"><display-entity entity-name="ContactMechType" key-field-name="contactMechTypeId"/></field>
        <field name="roleTypeId" title="${uiLabelMap.MarketingTrackingCodeVisitRoleTypeId}"><display-entity entity-name="RoleType" key-field-name="roleTypeId"/></field>
        <field name="userLoginId" title="${uiLabelMap.MarketingTrackingCodeVisitUserLoginId}"><display/></field>
        <field name="fromDate" title="${uiLabelMap.CommonFromDate}"><display/></field>
        <field name="thruDate" title="${uiLabelMap.CommonThruDate}"><display/></field>
        <field name="clientIpAddress" title="${uiLabelMap.MarketingTrackingCodeVisitClientIpAddress}"><display/></field>
        <field name="clientHostName" title="${uiLabelMap.MarketingTrackingCodeVisitClientHostName}"><display/></field>
        <field name="webappName" title="${uiLabelMap.MarketingTrackingCodeVisitWebappName}"><display/></field>
        <field name="sessionId" title="${uiLabelMap.MarketingTrackingCodeVisitSessionId}"><display/></field>
    </grid>
    
    <form name="EditTrackingCodeType" type="single" target="updateTrackingCodeType" title="" default-map-name="trackingCodeType"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="trackingCodeType==null" target="createTrackingCodeType"/>

        <field use-when="trackingCodeType!=null" name="trackingCodeTypeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeTypeId}"><display/></field>
        <field use-when="trackingCodeType==null&amp;&amp;trackingCodeTypeId==null" name="trackingCodeTypeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeTypeId}"><text/></field>
        <field use-when="trackingCodeType==null&amp;&amp;trackingCodeTypeId!=null" name="trackingCodeTypeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeTypeId}" tooltip="${uiLabelMap.CommonCannotBeFound}: [${trackingCodeTypeId}]"><display/></field>

        <field name="description" title="${uiLabelMap.MarketingTrackingCodeTypeDescription}"><text/></field>
        <field name="submitButton" title="${uiLabelMap.CommonSave}" widget-style="buttontext"><submit button-type="text-link"/></field>
        <!-- <field name="DONE_PAGE"><hidden value="${donePage}"/></field> -->
        <!-- <field name="cancelLink" title=" " widget-style="buttontext"><hyperlink description="${uiLabelMap.CommonCancelDone}" target="${donePage}" also-hidden="false" target-type="inter-app"/></field> -->
    </form>

    <grid name="ListTrackingCodeType" target="ListTrackingCodeType" title=""
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <actions>
            <entity-condition entity-name="TrackingCodeType"/>
        </actions>
        <field name="trackingCodeTypeId"  widget-style="buttontext" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeTypeId}">
            <hyperlink description="${trackingCodeTypeId}" target="EditTrackingCodeType" also-hidden="false">
                <parameter param-name="trackingCodeTypeId"/>
            </hyperlink>
        </field>
        <field name="description" title="${uiLabelMap.MarketingTrackingCodeTypeDescription}"><display/></field>

        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonDelete}" target="deleteTrackingCodeType" also-hidden="false">
                <parameter param-name="trackingCodeTypeId"/>
            </hyperlink>
        </field>
    </grid>
    
    <form name="LookupTrackingCodeType" default-map-name="trackingCode" target="LookupTrackingCodeType" title="" type="single"
        header-row-style="header-row" default-table-style="basic-table">
        <field name="trackingCodeTypeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeTypeId}"><text-find/></field>
        <field name="description" title="${uiLabelMap.MarketingTrackingCodeTypeDescription}"><text-find/></field>
        <field name="submitButton" title="${uiLabelMap.CommonSave}" widget-style="buttontext"><submit button-type="text-link"/></field>
    </form>
    
    <grid name="ListLookupTrackingCodeType" target="" title=""
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
        <actions>
            <service result-map-list="listIt" result-map="result" service-name="performFind">
                <field-map field-name="inputFields" from-field="parameters"/>
                <field-map field-name="entityName" from-field="entityName"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
            </service>
        </actions>
        <field name="trackingCodeTypeId" title="${uiLabelMap.MarketingTrackingCodeTrackingCodeTypeId}" widget-style="buttontext">
            <hyperlink description="${trackingCodeTypeId}" target="javascript:set_value('${trackingCodeTypeId}')" also-hidden="false" target-type="plain"/>
        </field>
        <field name="description" title="${uiLabelMap.MarketingTrackingCodeTypeDescription}"><display/></field>
    </grid>
</forms>
