<?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.
-->
<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns="http://ofbiz.apache.org/Widget-Screen" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Screen http://ofbiz.apache.org/dtds/widget-screen.xsd">

    <screen name="CommonQuoteDecorator">
        <section>
            <actions>
                <set field="headerItem" value="quote"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <!-- do check for ORDERMGR, _VIEW permission -->
                            <condition>
                                <if-has-permission permission="ORDERMGR" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <section>
                                    <condition>
                                        <not><if-empty field="quote"/></not>
                                    </condition>
                                    <widgets>
                                        <include-menu name="QuoteTabBar" location="component://order/widget/ordermgr/OrderMenus.xml"/>
                                        <container style="page-title">
                                            <label>${uiLabelMap[titleProperty]} [${uiLabelMap.CommonId}:${quote.quoteId}] ${quote.description}</label>
                                        </container>
                                    </widgets>
                                </section>
                                <container>
                                  <link target="EditQuote" text="${uiLabelMap.OrderCreateOrderQuote}" style="buttontext"/>
                                </container>
                                <decorator-section-include name="body"/>
                            </widgets>
                            <fail-widgets>
                                <label style="h3">${uiLabelMap.OrderViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <!-- list all assets in a tabular format -->
    <screen name="FindQuote">
        <section>
            <actions>
                <set field="titleProperty" value="OrderFindQuote"/>
                <set field="headerItem" value="quote"/>
                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                <set field="viewSizeDefaultValue" value="${groovy: modelTheme.getDefaultViewSize()}" type="Integer"/>
                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="${viewSizeDefaultValue}"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuotes}">
                            <container>
                                <link target="EditQuote" text="${uiLabelMap.OrderCreateOrderQuote}" style="buttontext"/>
                            </container>
                            <include-form name="FindQuotes" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                            <include-form name="ListQuotes" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
         </section>
    </screen>
    <screen name="ViewQuote">
        <section>
            <actions>
                <set field="titleProperty" value="OrderViewQuote"/>
                <set field="tabButtonItem" value="ViewQuote"/>

                <set field="showQuoteManagementLinks" value="Y"/>
                <set field="quoteId" from-field="parameters.quoteId"/>
                <entity-one entity-name="Quote" value-field="quote"/>
                <get-related-one value-field="quote" relation-name="QuoteType" to-value-field="quoteType"/>
                <get-related-one value-field="quote" relation-name="StatusItem" to-value-field="statusItem"/>
                <get-related-one value-field="quote" relation-name="SalesChannelEnumeration" to-value-field="salesChannel"/>
                <get-related-one value-field="quote" relation-name="Uom" to-value-field="currency"/>
                <get-related-one value-field="quote" relation-name="ProductStore" to-value-field="store"/>

                <set field="listOrderBy[]" value="quoteItemSeqId"/>
                <get-related value-field="quote" relation-name="QuoteItem" list="quoteItems" order-by-list="listOrderBy"/>
                <get-related value-field="quote" relation-name="QuoteAdjustment" list="quoteAdjustments"/>
                <get-related value-field="quote" relation-name="QuoteRole" list="quoteRoles"/>
                <!--
                <get-related value-name="quote" relation-name="QuoteAttribute" list-name="quoteAttributes"/>
                <get-related value-name="quote" relation-name="QuoteCoefficient" list-name="quoteCoefficients"/>
                -->
                <property-map resource="OrderUiLabels" map-name="uiLabelMap"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <container>
                            <include-menu name="QuoteSubTabBar" location="component://order/widget/ordermgr/OrderMenus.xml"/>
                        </container>
                        <include-screen name="ViewQuoteTemplate"/>
                        <screenlet title="${uiLabelMap.OrderCopyQuote}">
                            <platform-specific>
                                <html><html-template location="component://order/template/quote/CopyQuote.ftl"/></html>
                            </platform-specific>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="ViewQuoteSimple">
        <section>
            <actions>
                <set field="showQuoteManagementLinks" value="N"/>
                <set field="quoteId" from-field="parameters.quoteId"/>
                <entity-one entity-name="Quote" value-field="quote"/>
                <get-related-one value-field="quote" relation-name="QuoteType" to-value-field="quoteType"/>
                <get-related-one value-field="quote" relation-name="StatusItem" to-value-field="statusItem"/>
                <get-related-one value-field="quote" relation-name="Uom" to-value-field="currency"/>
                <get-related-one value-field="quote" relation-name="ProductStore" to-value-field="store"/>

                <get-related value-field="quote" relation-name="QuoteItem" list="quoteItems"/>
                <get-related value-field="quote" relation-name="QuoteAdjustment" list="quoteAdjustments"/>
                <get-related value-field="quote" relation-name="QuoteRole" list="quoteRoles"/>

                <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
            </actions>
            <widgets>
                <include-screen name="ViewQuoteTemplate"/>
            </widgets>
        </section>
    </screen>

    <screen name="QuoteReport">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteReport"/>

                <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>

                <set field="quoteId" from-field="parameters.quoteId"/>
                <entity-one entity-name="Quote" value-field="quote"/>
                <get-related-one value-field="quote" relation-name="QuoteType" to-value-field="quoteType"/>
                <get-related-one value-field="quote" relation-name="StatusItem" to-value-field="statusItem"/>
                <get-related-one value-field="quote" relation-name="Uom" to-value-field="currency"/>
                <get-related-one value-field="quote" relation-name="ProductStore" to-value-field="store"/>
                <get-related-one value-field="quote" relation-name="Party" to-value-field="party"/>
                <get-related value-field="quote" relation-name="QuoteTerm" list="quoteTerms"/>

                <set field="listOrderBy[]" value="quoteItemSeqId"/>
                <get-related value-field="quote" relation-name="QuoteItem" list="quoteItems" order-by-list="listOrderBy"/>
                <get-related value-field="quote" relation-name="QuoteAdjustment" list="quoteAdjustments"/>

                <script location="component://order/groovyScripts/quote/GetPartyAddress.groovy"/>
                <!--
                <get-related value-name="quote" relation-name="QuoteRole" list-name="quoteRoles"/>
                <get-related value-name="quote" relation-name="QuoteAttribute" list-name="quoteAttributes"/>
                <get-related value-name="quote" relation-name="QuoteCoefficient" list-name="quoteCoefficients"/>
                -->
            </actions>
            <widgets>
                <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml">
                    <!-- at the top left of every page we put the logo and company information -->
                    <decorator-section name="topLeft">
                        <section>
                            <widgets>
                                <include-screen name="CompanyLogo" location="component://order/widget/ordermgr/OrderPrintScreens.xml"/>
                            </widgets>
                        </section>
                    </decorator-section>
                    <!-- at the top right of every page we put the order information -->
                    <decorator-section name="topRight">
                        <section>
                            <widgets>
                                <platform-specific>
                                    <xsl-fo><html-template location="component://order/template/quote/QuoteReportHeaderInfo.fo.ftl"/></xsl-fo>
                                </platform-specific>
                            </widgets>
                        </section>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <widgets>
                                <!-- the contach mechanisms, terms, payment and shipping methods are shown in the first page -->
                                <platform-specific>
                                    <xsl-fo><html-template location="component://order/template/quote/QuoteReportContactMechs.fo.ftl"/></xsl-fo>
                                </platform-specific>
                                <!-- quote items and totals -->
                                <platform-specific>
                                    <xsl-fo><html-template location="component://order/template/quote/QuoteReportBody.fo.ftl"/></xsl-fo>
                                </platform-specific>
                            </widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

    <screen name="EditQuote">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteEdit"/>
                <set field="tabButtonItem" value="EditQuote"/>

                <set field="quoteId" from-field="parameters.quoteId"/>
                <entity-one entity-name="Quote" value-field="quote"/>

                <property-to-field field="defaultCurrencyUomId" resource="general" property="currency.uom.id.default" default="USD"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${groovy: parameters.quoteId ? uiLabelMap.OrderOrderQuoteEdit : uiLabelMap.OrderNewQuote}">
                            <include-form name="EditQuote" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="ListQuoteRoles">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteListRoles"/>
                <set field="tabButtonItem" value="ListQuoteRoles"/>

                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-and entity-name="QuoteRole" list="quoteRoles">
                    <field-map field-name="quoteId" from-field="quote.quoteId"/>
                </entity-and>

            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuoteListRoles}">
                            <container>
                                <link target="EditQuoteRole" text="${uiLabelMap.OrderCreateOrderQuoteRole}" style="buttontext">
                                    <parameter param-name="quoteId" from-field="quote.quoteId"/>
                                </link>
                            </container>
                            <include-form name="ListQuoteRoles" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditQuoteRole">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteEditRoles"/>
                <set field="tabButtonItem" value="ListQuoteRoles"/>

                <set field="quoteId" from-field="parameters.quoteId"/>
                <set field="quoteItemSeqId" from-field="parameters.quoteItemSeqId"/>

                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-one entity-name="QuoteRole" value-field="quoteRole"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuoteEditRoles}">
                            <container>
                                <link target="EditQuoteRole" text="${uiLabelMap.OrderCreateOrderQuoteRole}" style="buttontext">
                                    <parameter param-name="quoteId" from-field="quote.quoteId"/>
                                </link>
                            </container>
                            <include-form name="EditQuoteRole" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="ListQuoteItems">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteListItems"/>
                <set field="tabButtonItem" value="ListQuoteItems"/>

                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                <set field="viewSizeDefaultValue" value="${groovy: modelTheme.getDefaultViewSize()}" type="Integer"/>
                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="${viewSizeDefaultValue}"/>
                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-and entity-name="QuoteItem" list="quoteItems">
                    <field-map field-name="quoteId" from-field="quote.quoteId"/>
                    <order-by field-name="quoteItemSeqId"/>
                </entity-and>

            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <include-menu name="QuoteItemSubTabBar" location="component://order/widget/ordermgr/OrderMenus.xml"/>
                        <screenlet title="${uiLabelMap.OrderOrderQuoteListItems}">
                            <include-form name="ListQuoteItems" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditQuoteItem">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteEditItems"/>
                <set field="tabButtonItem" value="ListQuoteItems"/>

                <set field="quoteId" from-field="parameters.quoteId"/>
                <set field="quoteItemSeqId" from-field="parameters.quoteItemSeqId"/>

                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-one entity-name="QuoteItem" value-field="quoteItem"/>
                <entity-and entity-name="QuoteTerm" list="quoteTerms">
                    <field-map field-name="quoteId"  from-field="parameters.quoteId"/>
                    <field-map field-name="quoteItemSeqId" from-field="parameters.quoteItemSeqId"/>
                </entity-and>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <container>
                            <include-menu name="QuoteTermSubTabBar" location="component://order/widget/ordermgr/OrderMenus.xml"/>
                        </container>
                        <container style="lefthalf">
                            <screenlet title="${uiLabelMap.OrderOrderQuoteEditItems}" >
                                <include-form name="EditQuoteItem" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                            </screenlet>
                        </container>
                        <container style="righthalf">
                            <section>
                                <condition>
                                    <not><if-empty field="quoteItemSeqId"/></not>
                                </condition>
                                <widgets>
                                    <screenlet title="${uiLabelMap.OrderOrderQuoteTermList}">
                                        <include-form name="ListQuoteTermItem" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                                    </screenlet>
                                </widgets>
                            </section>
                        </container>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="ListQuoteAttributes">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteListAttributes"/>
                <set field="tabButtonItem" value="ListQuoteAttributes"/>

                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-and entity-name="QuoteAttribute" list="quoteAttributes">
                    <field-map field-name="quoteId" from-field="quote.quoteId"/>
                </entity-and>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuoteListAttributes}">
                            <container style="basic-nav">
                                <link target="EditQuoteAttribute" text="${uiLabelMap.OrderCreateOrderQuoteAttribute}" style="buttontext">
                                    <parameter param-name="quoteId" from-field="quote.quoteId"/>
                                </link>
                            </container>
                            <include-form name="ListQuoteAttributes" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditQuoteAttribute">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteEditAttributes"/>
                <set field="tabButtonItem" value="ListQuoteAttributes"/>

                <set field="quoteId" from-field="parameters.quoteId"/>
                <set field="attrName" from-field="parameters.attrName"/>

                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-one entity-name="QuoteAttribute" value-field="quoteAttribute"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuoteEditAttributes}">
                            <container>
                                <link target="EditQuoteAttribute" text="${uiLabelMap.OrderCreateOrderQuoteAttribute}" style="buttontext">
                                    <parameter param-name="quoteId" from-field="quote.quoteId"/>
                                </link>
                            </container>
                            <include-form name="EditQuoteAttribute" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="ListQuoteCoefficients">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteListCoefficients"/>
                <set field="tabButtonItem" value="ListQuoteCoefficients"/>

                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-and entity-name="QuoteCoefficient" list="quoteCoefficients">
                    <field-map field-name="quoteId" from-field="quote.quoteId"/>
                </entity-and>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuoteListCoefficients}">
                            <container style="basic-nav">
                                <link target="EditQuoteCoefficient" text="${uiLabelMap.OrderCreateOrderQuoteCoefficient}" style="buttontext">
                                    <parameter param-name="quoteId" from-field="quote.quoteId"/>
                                </link>
                            </container>
                            <include-form name="ListQuoteCoefficients" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditQuoteCoefficient">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteEditCoefficients"/>
                <set field="tabButtonItem" value="ListQuoteCoefficients"/>

                <set field="quoteId" from-field="parameters.quoteId"/>
                <set field="attrName" from-field="parameters.coeffName"/>

                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-one entity-name="QuoteCoefficient" value-field="quoteCoefficient"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuoteEditCoefficients}">
                            <container>
                                <link target="EditQuoteCoefficient" text="${uiLabelMap.OrderCreateOrderQuoteCoefficient}" style="buttontext">
                                    <parameter param-name="quoteId" from-field="quote.quoteId"/>
                                </link>
                            </container>
                            <include-form name="EditQuoteCoefficient" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="ManageQuotePrices">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuotePrices"/>
                <set field="tabButtonItem" value="ManageQuotePrices"/>
                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                <set field="viewSizeDefaultValue" value="${groovy: modelTheme.getDefaultViewSize()}" type="Integer"/>
                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="${viewSizeDefaultValue}"/>

                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-and entity-name="QuoteItem" list="quoteItems">
                    <field-map field-name="quoteId" from-field="quote.quoteId"/>
                    <order-by field-name="custRequestId"/>
                    <order-by field-name="custRequestItemSeqId"/>
                    <order-by field-name="quoteItemSeqId"/>
                </entity-and>
                <entity-and entity-name="QuoteCoefficient" list="quoteCoefficients">
                    <field-map field-name="quoteId" from-field="quote.quoteId"/>
                </entity-and>
                <set from-field="quote.quoteId" field="quoteId"/>

                <script location="component://order/groovyScripts/quote/ManageQuotePrices.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuotePrices}">
                            <platform-specific>
                                <html><html-template location="component://order/template/quote/ManageQuotePrices.ftl"/></html>
                            </platform-specific>
                        </screenlet>
                        <screenlet title="${uiLabelMap.OrderOrderQuotePrices}">
                            <include-form name="ManageQuotePrices" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                            <platform-specific>
                                <html><html-template location="component://order/template/quote/ManageQuotePricesTotals.ftl"/></html>
                            </platform-specific>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="ListQuoteAdjustments">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteListAdjustments"/>
                <set field="tabButtonItem" value="ListQuoteAdjustments"/>
                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                <set field="viewSizeDefaultValue" value="${groovy: modelTheme.getDefaultViewSize()}" type="Integer"/>
                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="${viewSizeDefaultValue}"/>

                <set field="quoteId" from-field="parameters.quoteId"/>
                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-and entity-name="QuoteAdjustment" list="quoteAdjustments">
                    <field-map field-name="quoteId" from-field="quote.quoteId"/>
                </entity-and>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuoteListAdjustments}">
                            <container style="basic-nav">
                                <link target="autoCreateQuoteAdjustments" text="${uiLabelMap.OrderRunStorePromotions}" style="buttontext">
                                    <parameter param-name="quoteId"/>
                                </link>
                                <link target="EditQuoteAdjustment" text="${uiLabelMap.OrderCreateOrderQuoteAdjustment}" style="buttontext">
                                    <parameter param-name="quoteId" from-field="quote.quoteId"/>
                                </link>
                            </container>
                            <include-form name="ListQuoteAdjustments" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditQuoteAdjustment">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteEditAdjustments"/>
                <set field="tabButtonItem" value="ListQuoteAdjustments"/>

                <set field="quoteId" from-field="parameters.quoteId"/>
                <set field="quoteAdjustmentId" from-field="parameters.quoteAdjustmentId"/>

                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-one entity-name="QuoteAdjustment" value-field="quoteAdjustment"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuoteEditAdjustments}">
                            <container>
                                <link target="EditQuoteAdjustment" text="${uiLabelMap.OrderCreateOrderQuoteAdjustment}" style="buttontext">
                                    <parameter param-name="quoteId" from-field="quote.quoteId"/>
                                </link>
                            </container>
                            <include-form name="EditQuoteAdjustment" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="ViewQuoteProfit">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteViewProfit"/>
                <set field="tabButtonItem" value="ViewQuoteProfit"/>
                <set field="viewIndex" from-field="parameters.VIEW_INDEX" type="Integer"/>
                <set field="viewSizeDefaultValue" value="${groovy: modelTheme.getDefaultViewSize()}" type="Integer"/>
                <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="${viewSizeDefaultValue}"/>

                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-and entity-name="QuoteItem" list="quoteItems">
                    <field-map field-name="quoteId" from-field="quote.quoteId"/>
                    <order-by field-name="custRequestId"/>
                    <order-by field-name="custRequestItemSeqId"/>
                    <order-by field-name="quoteItemSeqId"/>
                </entity-and>
                <entity-and entity-name="QuoteCoefficient" list="quoteCoefficients">
                    <field-map field-name="quoteId" from-field="quote.quoteId"/>
                </entity-and>
                <set from-field="quote.quoteId" field="quoteId"/>

                <script location="component://order/groovyScripts/quote/ViewQuoteProfit.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuoteViewProfit}">
                            <platform-specific>
                                <html><html-template location="component://order/template/quote/ViewQuoteProfit.ftl"/></html>
                            </platform-specific>
                            <include-form name="ViewQuoteProfit" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditQuoteReportMail">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteEditReportMail"/>
                <set field="tabButtonItem" value="ViewQuote"/>

                <set field="quoteId" from-field="parameters.quoteId"/>
                <entity-one entity-name="Quote" value-field="quote"/>
                <get-related-one value-field="quote" relation-name="Party" to-value-field="party"/>
                <script location="component://order/groovyScripts/quote/GetPartyEmailAddress.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuoteEditReportMail}">
                            <include-form name="EditQuoteReportMail" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="ViewQuoteTemplate">
        <section>
            <condition>
                <not><if-empty field="quote"/></not>
            </condition>
            <widgets>
                <label text="${note}"/>
                <include-screen name="ViewQuoteInfo"/>
                <container style="clear"/>
                    <include-screen name="ViewQuoteItemInfo"/>
            </widgets>
            <fail-widgets>
                <label style="h3">${uiLabelMap.OrderNoQuoteFound}</label>
            </fail-widgets>
        </section>
    </screen>
    <screen name="ViewQuoteInfo">
        <section>
            <actions>
                <entity-and entity-name="QuoteTerm" list="quoteTerms">
                    <field-map field-name="quoteId"  from-field="parameters.quoteId"/>
                    <field-map field-name="quoteItemSeqId" value="_NA_"/>
                </entity-and>
                <entity-and entity-name="QuoteNoteView" list="quoteNotes">
                    <field-map field-name="quoteId"  from-field="parameters.quoteId"/>
                    <order-by field-name="-noteDateTime"/>
                </entity-and>
            </actions>
            <widgets>
                <container style="lefthalf">
                    <include-screen name="quoteInfo"/>
                </container>
                <container style="righthalf">
                    <include-screen name="quoteDate"/>
                    <include-screen name="quoteRoles"/>
                    <include-screen name="ListQuoteInfo"/>
                    <include-screen name="ListQuoteNoteInfo"/>
                </container>
            </widgets>
        </section>
    </screen>
    <screen name="quoteInfo">
        <section>
            <actions>
                <entity-one entity-name="PartyNameView" value-field="toParty">
                    <field-map field-name="partyId"  from-field="quote.partyId"/>
                </entity-one>
            </actions>
            <widgets>
                <platform-specific>
                    <html><html-template location="component://order/template/quote/QuoteInfo.ftl"/></html>
                </platform-specific>
            </widgets>
        </section>
    </screen>
    <screen name="ListQuoteInfo">
        <section>
            <condition>
                <not><if-empty field="quoteTerms"/></not>
            </condition>
            <widgets>
                <screenlet title="${uiLabelMap.OrderOrderQuoteTermList}">
                    <include-form name="ListQuoteInfo" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                </screenlet>
            </widgets>
        </section>
    </screen>
    <screen name="ListQuoteNoteInfo">
        <section>
            <condition>
                <not><if-empty field="quoteNotes"/></not>
            </condition>
            <widgets>
                <screenlet title="${uiLabelMap.OrderOrderQuoteNotes}">
                    <include-form name="ListQuoteNoteInfo" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                </screenlet>
            </widgets>
        </section>
    </screen>
    <screen name="quoteDate">
        <section>
            <widgets>
                <platform-specific>
                    <html><html-template location="component://order/template/quote/QuoteDate.ftl"/></html>
                </platform-specific>
            </widgets>
        </section>
    </screen>
    <screen name="quoteRoles">
        <section>
            <widgets>
                <platform-specific>
                    <html><html-template location="component://order/template/quote/QuoteRoles.ftl"/></html>
                </platform-specific>
            </widgets>
        </section>
    </screen>
    <screen name="ViewQuoteItemInfo">
        <section>
            <condition>
                <not><if-empty field="quoteItems"/></not>
            </condition>
            <actions>
                <entity-and entity-name="QuoteItem" list="quoteItemList">
                    <field-map field-name="quoteId" from-field="parameters.quoteId"/>
                </entity-and>
                <entity-one entity-name="Quote" value-field="quote">
                    <field-map field-name="quoteId" from-field="parameters.quoteId"/>
                </entity-one>
                <set field="quoteStatusId" from-field="quote.statusId"/>
            </actions>
            <widgets>
                <platform-specific>
                    <html><html-template location="component://order/template/quote/ViewQuoteItemInfo.ftl"/></html>
                </platform-specific>
            </widgets>
        </section>
    </screen>
    <screen name="EditQuoteTerm">
        <section>
            <actions>
                <set field="titleProperty" from-field="uiLabelMap.OrderOrderQuoteEditTerm"/>
                <set field="tabButtonItem" value="QuoteTerms"/>
                <set field="quoteId" from-field="parameters.quoteId"/>
                <set field="termTypeId" from-field="parameters.termTypeId"/>
                <set field="quoteItemSeqId" from-field="parameters.quoteItemSeqId"/>
                <entity-one entity-name="QuoteTerm" value-field="quoteTerm"/>
                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <set field="target" from-field="parameters.target"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuoteEditTerm}">
                            <include-form name="EditQuoteTerm" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditQuoteTermItem">
        <section>
            <actions>
                <set field="titleProperty" from-field="uiLabelMap.OrderOrderQuoteEditTerm"/>
                <set field="tabButtonItem" value="ListQuoteItems"/>
                <set field="quoteId" from-field="parameters.quoteId"/>
                <set field="termTypeId" from-field="parameters.termTypeId"/>
                <set field="quoteItemSeqId" from-field="parameters.quoteItemSeqId"/>
                <entity-one entity-name="QuoteTerm" value-field="quoteTerm"/>
                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <set field="target" from-field="parameters.target"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.OrderOrderQuoteEditTerm}">
                            <include-form name="EditQuoteTermItem" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="ListQuoteTerms">
        <section>
            <actions>
                <set field="titleProperty" from-field="uiLabelMap.OrderOrderQuoteEditTerm"/>
                <set field="tabButtonItem" value="QuoteTerms"/>
                <set field="quoteId" from-field="parameters.quoteId"/>
                <set field="termTypeId" from-field="parameters.termTypeId"/>
                <set field="quoteItemSeqId" from-field="parameters.quoteItemSeqId"/>
                <entity-one entity-name="QuoteTerm" value-field="quoteTerm"/>
                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-and entity-name="QuoteTerm" list="quoteTerms">
                    <field-map field-name="quoteId"  from-field="parameters.quoteId"/>
                </entity-and>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <include-menu name="QuoteTermSubTabBar" location="component://order/widget/ordermgr/OrderMenus.xml"/>
                        <screenlet title="${uiLabelMap.OrderOrderQuoteTermList}">
                            <include-form name="ListQuoteTerms" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="ListQuoteNotes">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderQuoteNoteList"/>
                <set field="tabButtonItem" value="ListQuoteNotes"/>
                <set field="quoteId" from-field="parameters.quoteId"/>
                <set field="headerRowStyle" value="header-row-2"/>
                <entity-one entity-name="Quote" value-field="quote" auto-field-map="true"/>
                <entity-and entity-name="QuoteNoteView" list="quoteNotes">
                    <field-map field-name="quoteId"  from-field="parameters.quoteId"/>
                    <order-by field-name="-noteDateTime"/>
                </entity-and>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator" location="${parameters.quoteDecoratorLocation}">
                    <decorator-section name="body">
                        <container style="button-bar button-style-1">
                            <link target="createnewquotenote" text="${uiLabelMap.OrderCreateOrderQuoteNote}">
                                <parameter param-name="quoteId" from-field="quote.quoteId"/>
                            </link>
                        </container>
                        <include-form name="ListQuoteNotes" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="QuoteNewNote">
        <section>
            <condition>
                <not><if-empty field="parameters.quoteId"/></not>
            </condition>
            <actions>
                <set field="titleProperty" value="OrderAddNote"/>
                <set field="tabButtonItem" value="QuoteNotes"/>
                <set field="target" value="createquotenote"/>
                <set field="quoteId" from-field="parameters.quoteId"/>
                <entity-one entity-name="Quote" value-field="quote"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator">
                    <decorator-section name="body">
                        <include-form name="AddOrEditQuoteNote" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
            <fail-widgets>
                <label style="h3">${uiLabelMap.OrderViewPermissionError}</label>
            </fail-widgets>
        </section>
    </screen>
    <screen name="EditQuoteNote">
        <section>
            <condition>
                <and>
                    <not><if-empty field="parameters.noteId"/></not>
                    <not><if-empty field="parameters.quoteId"/></not>
                </and>
            </condition>
            <actions>
                <set field="titleProperty" value="QuoteEditNote"/>
                <set field="tabButtonItem" value="QuoteNotes"/>
                <set field="target" value="updateQuoteNote"/>
                <set field="quoteId" from-field="parameters.quoteId"/>
                <set field="noteId" from-field="parameters.noteId"/>
                <entity-one entity-name="Quote" value-field="quote"/>
                <entity-one entity-name="QuoteNoteView" value-field="quoteNoteData"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonQuoteDecorator">
                    <decorator-section name="body">
                        <include-form name="AddOrEditQuoteNote" location="component://order/widget/ordermgr/QuoteForms.xml"/>
                    </decorator-section>
                </decorator-screen>
            </widgets>
            <fail-widgets>
                <label style="h3">${uiLabelMap.OrderViewPermissionError}</label>
            </fail-widgets>
        </section>
    </screen>

</screens>
