<?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="CreateProductCategoryAttribute" header-row-style="header-row" default-table-style="basic-table" type="single" target="createProductCategoryAttribute" title="">
        <auto-fields-service service-name="createProductCategoryAttribute" default-field-type="edit"/>
        <field name="productCategoryId"><display/></field>
        <field name="submitForm" title="${uiLabelMap.CommonCreate}"><submit/></field>
    </form>
    <grid name="EditProductCategoryAttributes" list-name="categoryAttributes" target="updateProductCategoryAttribute"
        odd-row-style="alternate-row" default-table-style="basic-table" >
        <auto-fields-service service-name="updateProductCategoryAttribute" default-field-type="display"/>
        <field name="productCategoryId"><hidden/></field>
        <field name="attrValue"><text size="60"/></field>
        <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonDelete}" target="deleteProductCategoryAttribute">
                <parameter param-name="productCategoryId"/>
                <parameter param-name="attrName"/>
            </hyperlink>
        </field>
    </grid>
    <grid name="CategoryProducts" list-name="productCategoryMembers"
        odd-row-style="alternate-row" default-table-style="basic-table">
        <auto-fields-entity entity-name="ProductCategoryMember" default-field-type="display"/>
        <field name="productCategoryId"><hidden/></field>
    </grid>
    <form name="AddCategoryContentAssoc" type="single" target="addContentToCategory" title="${uiLabelMap.ProductAddProductCategoryContentFromDate}"
        header-row-style="header-row" default-table-style="basic-table">
        <auto-fields-entity entity-name="ProductCategoryContent"/>
        <field name="productCategoryId" map-name="productCategory"><hidden/></field>
        <field name="contentId" title="${uiLabelMap.ProductContentId}">
            <lookup target-form-name="LookupContent"/>
        </field>
        <field name="prodCatContentTypeId">
            <drop-down>
                <entity-options entity-name="ProductCategoryContentType">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
    </form>

    <form name="PrepareAddCategoryContentAssoc" type="single" target="prepareAddContentToCategory" title="${uiLabelMap.ProductAddProductCategoryContentFromDate}"
        odd-row-style="alternate-row" default-table-style="basic-table">
        <field name="productId"><hidden/></field>
        <field name="productCategoryId" map-name="productCategory"><hidden/></field>
        <field name="prodCatContentTypeId">
            <drop-down>
                <entity-options entity-name="ProductCategoryContentType">
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <!-- <field name="description"><text size="40"/></field> -->
        <field name="submitButton" title="${uiLabelMap.ProductPrepareCreate}" widget-style="smallSubmit"><submit button-type="button"/></field>
    </form>

    <grid name="UpdateCategoryContentAssoc" list-name="productCategoryContentList" target="updateContentToCategory"
        odd-row-style="alternate-row" default-table-style="basic-table">
        <field name="productCategoryId"><hidden/></field>
        <field name="contentId" title="${uiLabelMap.ProductContent}">
            <display-entity entity-name="Content" also-hidden="true">
                <sub-hyperlink target="EditCategoryContentContent" description="${contentId}" link-style="buttontext">
                    <parameter param-name="productCategoryId"/>
                    <parameter param-name="contentId"/>
                    <parameter param-name="prodCatContentTypeId"/>
                    <parameter param-name="fromDate"/>
                </sub-hyperlink>
            </display-entity>
        </field>
        <field name="prodCatContentTypeId" title="${uiLabelMap.ProductType}">
            <display-entity entity-name="ProductCategoryContentType" also-hidden="false"/>
        </field>
        <field name="fromDate"><display/></field>
        <field name="thruDate"><display/></field>
        <field name="editLink" title="${uiLabelMap.ProductEditContent}" widget-style="buttontext">
            <hyperlink description="${contentId}" target="/content/control/EditContent" target-type="inter-app">
                <parameter param-name="contentId"/>
            </hyperlink>
        </field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonDelete}" target="removeContentFromCategory" also-hidden="false">
                <parameter param-name="productCategoryId"/>
                <parameter param-name="contentId"/>
                <parameter param-name="prodCatContentTypeId"/>
                <parameter param-name="fromDate"/>
            </hyperlink>
        </field>
    </grid>

    <form name="EditCategoryContentSimpleText" type="single" default-map-name="categoryContent" target="updateSimpleTextContentForCategory" title="${uiLabelMap.ProductUpdateSimpleTextContentCategory}"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="content==null" target="createSimpleTextContentForCategory"/>
        <auto-fields-entity entity-name="ProductCategoryContent"/>

        <field use-when="content==null" name="contentId"><ignored/></field>
        <field use-when="content!=null" name="contentId" tooltip="${uiLabelMap.ProductNotModificationRecrationProductContentAssociation}" map-name="categoryContentData"><display/></field>
        <field name="fromDate" use-when="contentId==null" title="${uiLabelMap.CommonFromDate}*" ><date-time/></field>
        <field name="fromDate" use-when="contentId!=null" title="${uiLabelMap.CommonFromDate}" ><display/></field>

        <field name="prodCatContentTypeId"><display-entity entity-name="ProductCategoryContentType" also-hidden="true"/></field>
        <field name="description" map-name="content"><text size="40"/></field>
        <field name="localeString" map-name="content"><text size="40"/></field>
        <field name="text" map-name="textDataMap"><textarea cols="80" rows="10"/></field>
        <field name="textDataResourceId" map-name="textDataMap"><hidden/></field>
        <field name="useCountLimit"><hidden/></field>
        <field name="purchaseThruDate"><hidden/></field>
        <field name="purchaseFromDate"><hidden/></field>
        <field name="productCategoryId"><hidden/></field>
        <field use-when="content == null" name="submitButton" title="${uiLabelMap.CommonCreate}" widget-style="smallSubmit"><submit button-type="button"/></field>
        <field use-when="content != null" name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
    </form>

    <form name="CreateSimpleTextContentForAlternateLocale" type="single" target="createSimpleTextContentForAlternateLocaleInCategory" title="${uiLabelMap.ProductCreateSimpleTextContentForAlternateLocale}"
        header-row-style="header-row" default-table-style="basic-table">
        <field name="productCategoryId"><hidden/></field>
        <field name="mainContentId" entry-name="contentId"><hidden/></field>
        <field name="localeString"><text/></field>
        <field name="text"><text/></field>
        <field name="submitButton" title="${uiLabelMap.CommonCreate}"><submit button-type="button"/></field>
    </form>

    <!-- ProductCategoryLink Forms-->
    <grid name="ListProductCategoryLinks" list-name="productCategoryLinks" target="updateProductCategoryLink" separate-columns="true"
        odd-row-style="alternate-row" default-table-style="basic-table">
        <actions>
            <entity-condition entity-name="ProductCategoryLink">
                <condition-expr field-name="productCategoryId" from-field="productCategoryId"/>
                <order-by field-name="sequenceNum"/>
            </entity-condition>
        </actions>
        <auto-fields-service service-name="updateProductCategoryLink"/>
        <field name="productCategoryId"><hidden/></field>
        <field name="linkSeqId"><display/></field>
        <field name="fromDate" title="${uiLabelMap.CommonFromDate}"><display/></field>
        <field name="thruDate" title="${uiLabelMap.CommonThruDate}"><date-time/></field>
        <field name="titleText"><text size="20" maxlength="250"/></field>
        <field name="comments"><text size="20" maxlength="250"/></field>
        <field name="sequenceNum" title="${uiLabelMap.CommonSequence}"><text maxlength="5" size="5"/></field>
        <field name="linkTypeEnumId"><ignored/></field>
        <field name="detailText"><ignored/></field>
        <field name="linkInfo"><ignored/></field>
        <field name="detailSubScreen"><ignored/></field>
        <field name="imageUrl"><ignored/></field>
        <field name="imageTwoUrl"><ignored/></field>
        <field name="deleteLink" title=" " widget-style="buttontext">
            <hyperlink description="${uiLabelMap.CommonDelete}" target="deleteProductCategoryLink" also-hidden="false">
                <parameter param-name="productCategoryId"/>
                <parameter param-name="linkSeqId"/>
                <parameter param-name="fromDate"/>
            </hyperlink>
        </field>
        <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
    </grid>

    <form name="AddProductCategoryLink" type="single" target="createProductCategoryLink" title="" default-map-name="productCategoryLink"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="productCategoryLink != null" target="updateProductCategoryLink"/>
        <auto-fields-service service-name="createProductCategoryLink"/>
        <field name="productCategoryId"><hidden/></field>
        <field name="linkSeqId" use-when="productCategoryLink==null"><ignored/></field>
        <field name="linkSeqId" use-when="productCategoryLink!=null"><display/></field>
        <field use-when="productCategoryLink != null" name="fromDate"><display/></field>
        <field use-when="productCategoryLink == null" name="fromDate" title="${uiLabelMap.CommonFromDate}"><date-time/></field>
        <field name="thruDate" title="${uiLabelMap.CommonThruDate}"><date-time/></field>
        <field name="sequenceNum" title="${uiLabelMap.CommonSequence}"><text maxlength="5" size="5"/></field>
        <field name="imageUrl" tooltip="${uiLabelMap.ProductImageUrlTooltip}"><text size="60" maxlength="255"/></field>
        <field name="linkTypeEnumId" title="${uiLabelMap.ProductLinkTypeEnumId}">
            <drop-down allow-empty = "false">
                <entity-options description="${groovy: uiLabelMap.get(&quot;ProductCategoryLinkType.description.&quot;+enumId)}" entity-name="Enumeration" key-field-name="enumId">
                    <entity-constraint name="enumTypeId" operator="equals" value="PCAT_LINK_TYPE"/>
                    <entity-order-by field-name="description"/>
                </entity-options>
            </drop-down>
        </field>
        <field name="detailSubScreen" tooltip="${uiLabelMap.ProductDetailSubScreenTooltip}"><text size="60" maxlength="255"/></field>
        <field name="submitButton" use-when="productCategoryLink==null" title="${uiLabelMap.CommonAdd}"><submit button-type="button"/></field>
        <field name="submitButton" use-when="productCategoryLink!=null" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
        <field name="clearFormButton" title=" " use-when="productCategoryLink!=null">
            <hyperlink description="${uiLabelMap.CommonClear}" target="EditProductCategoryLinks" target-type="intra-app">
                <parameter param-name="productCategoryId"/>
            </hyperlink>
        </field>
    </form>

    <grid name="ListTopCategory" list-name="noParentCategories" odd-row-style="alternate-row" default-table-style="basic-table">
        <field name="productCategoryId"  widget-style="buttontext">
            <hyperlink description="${productCategoryId}" target="EditCategory" also-hidden="false">
                <parameter param-name="CATALOG_TOP_CATEGORY" value="${productCategoryId}"/>
                <parameter param-name="productCategoryId" value="${productCategoryId}"/>
            </hyperlink>
        </field>
        <field name="description"><display/></field>
    </grid>

    <form name="FindCategory" type="single" target="FindCategory" title="" default-map-name="category"
        header-row-style="header-row" default-table-style="basic-table">
        <field name="noConditionFind"><hidden value="Y"/><!-- if this isn't there then with all fields empty no query will be done --></field>
        <field name="productCategoryId" title="${uiLabelMap.ProductCategoryId}"><text-find/></field>
        <field name="categoryName" title="${uiLabelMap.FormFieldTitle_categoryName}"><text-find/></field>
        <field name="submitButton" title="${uiLabelMap.CommonFind}" widget-style="smallSubmit">
            <submit button-type="button"/>
        </field>
    </form>

    <grid name="ListCategory" list-name="listIt" paginate-target="FindCategory"
        odd-row-style="alternate-row" default-table-style="basic-table hover-bar" header-row-style="header-row-2">
        <actions>
            <set field="entityName" value="ProductCategory"/>
            <service service-name="performFind" result-map="result" result-map-list="listIt">
                <field-map field-name="inputFields" from-field="requestParameters"/>
                <field-map field-name="entityName" from-field="entityName"/>
                <field-map field-name="orderBy" from-field="parameters.sortField"/>
                <field-map field-name="viewIndex" from-field="viewIndex"/>
                <field-map field-name="viewSize" from-field="viewSize"/>
            </service>
        </actions>
        <field name="productCategoryId" sort-field="true" widget-style="buttontext">
            <hyperlink description="${productCategoryId}" target="EditCategory" also-hidden="false">
                <parameter param-name="productCategoryId"/>
            </hyperlink>
        </field>
        <field name="productCategoryTypeId" sort-field="true"><display-entity entity-name="ProductCategoryType"/></field>
        <field name="primaryParentCategoryId" sort-field="true"><display/></field>
        <field name="categoryName" sort-field="true"><display/></field>
        <field name="description" sort-field="true"><display/></field>
    </grid>

    <form name="EditCategoryContentSEO" type="single" target="updateContentSEOForCategory" title="${uiLabelMap.ProductUpdateSEOContentCategory}"
        header-row-style="header-row" default-table-style="basic-table">
        <field name="title" title="${uiLabelMap.PageTitle}"><text size="40"/></field>
        <field name="metaKeyword" title="${uiLabelMap.MetaKeywords}"><textarea cols="60" rows="5"/></field>
        <field name="metaDescription" title="${uiLabelMap.MetaDescription}"><textarea cols="60" rows="5"/></field>
        <field name="productCategoryId"><hidden/></field>
        <field name="prodCatContentTypeId"><hidden/></field>
        <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
    </form>

    <form name="EditCategoryContentRelatedUrl" type="single" target="updateRelatedUrlContentForCategory" title="${uiLabelMap.ProductUpdateRelatedURLContentCategory}"
        header-row-style="header-row" default-table-style="basic-table">
        <alt-target use-when="content==null" target="createRelatedUrlContentForCategory"/>
        <auto-fields-entity entity-name="ProductCategoryContent"/>
        <field use-when="content==null" name="contentId"><ignored/></field>
        <field use-when="content!=null" name="contentId" tooltip="${uiLabelMap.ProductNotModificationRecrationProductContentAssociation}" map-name="categoryContentData"><display/></field>
        <field name="fromDate" use-when="contentId==null" title="${uiLabelMap.CommonFromDate}*" ><date-time/></field>
        <field name="fromDate" use-when="contentId!=null" title="${uiLabelMap.CommonFromDate}" ><display/></field>
        <field name="dataResourceId"><hidden/></field>
        <field name="prodCatContentTypeId"><display-entity entity-name="ProductCategoryContentType" also-hidden="true"/></field>
        <field name="title" title="${uiLabelMap.CommonTitle}"><text size="50"></text></field>
        <field name="description" title="${uiLabelMap.FormFieldTitle_description}"><textarea cols="50" rows="2"/></field>
        <field name="url"><textarea cols="50" rows="2"/></field>
        <field name="localeString">
            <lookup target-form-name="LookupLocale"></lookup>
        </field>
        <field name="purchaseFromDate"><hidden/></field>
        <field name="purchaseThruDate"><hidden/></field>
        <field name="useCountLimit"><hidden/></field>
        <field name="useDaysLimit"><hidden/></field>
        <field name="productCategoryId"><hidden/></field>
        <field use-when="content == null" name="submitButton" title="${uiLabelMap.CommonCreate}" widget-style="smallSubmit"><submit button-type="button"/></field>
        <field use-when="content != null" name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
    </form>
    
    <form name="EditCategoryContentDownload" type="upload" target="updateDownloadContentForCategory" title="${uiLabelMap.ProductUpdateDownloadContentCategory}">
        <alt-target use-when="contentId==null" target="createDownloadContentForCategory"/>
        <auto-fields-entity entity-name="ProductCategoryContent" map-name="productCategoryContentData"/>
        <field name="fromDate" use-when="contentId==null" title="${uiLabelMap.CommonFromDate}*" ><date-time/></field>
        <field name="fromDate" use-when="contentId!=null" title="${uiLabelMap.CommonFromDate}" ><display/></field>
        <field name="thruDate" title="${uiLabelMap.CommonThruDate}"></field>
        <field name="purchaseFromDate" title="${uiLabelMap.ProductPurchaseFromDate}"></field>
        <field name="purchaseThruDate" title="${uiLabelMap.ProductPurchaseThruDate}"></field>
        <field name="useCountLimit" title="${uiLabelMap.ProductUseCountLimit}"></field>
        <field name="useDaysLimit" title="${uiLabelMap.ProductUseTime}"></field>
        
        <field name="description" title="${uiLabelMap.ProductCategoryDescription}" map-name="content"><text size="40"/></field>
        <field use-when="contentId == null" name="contentId" title="${uiLabelMap.ProductContentId}" tooltip="${uiLabelMap.ProductOptional}"><text maxlength="20"/></field>
        <field use-when="contentId != null" name="contentId" title="${uiLabelMap.ProductContentId}" tooltip="${uiLabelMap.ProductNotModificationRecrationProductContentAssociation}" map-name="productContentData" >
            <hyperlink description="${contentId} ${contentName}" target="/content/control/editContent" target-type="inter-app">
                <parameter param-name="contentId"/>
            </hyperlink>
        </field>
        <field name="imageData" title="${uiLabelMap.ProductFile}"><file/></field>
        <field name="fileDataResourceId"><hidden/></field>
        <field name="productCategoryId"><hidden/></field>
        <field name="prodCatContentTypeId"><hidden/></field>
        <field name="dataResourceTypeId"><hidden/></field>
        <field use-when="contentId == null" name="submitButton" title="${uiLabelMap.CommonCreate}" widget-style="smallSubmit"><submit button-type="button"/></field>
        <field use-when="contentId != null" name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>
    </form>
</forms>
