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

<!-- These forms are for generating printed documents, such as invoices, bills, statements, etc. -->

<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">

    <!-- generate a PDF for the order, sharing the same groovy file as the HTML page for viewing the order -->
    <screen name="OrderPDF">
         <section>
             <actions>
                <set field="defaultTemplateLocation" value="component://order/widget/ordermgr/OrderPrintScreens.xml"/>
                <set field="defaultTemplateName" value="DefaultOrderPDF"/>
                <script location="component://commonext/src/main/groovy/org/apache/ofbiz/commonext/template/DocTypeTemplate.groovy"/>
            </actions>
            <widgets>
                <include-screen name="${templateName}" location="${templateLocation}"/>
            </widgets>
        </section>
    </screen>
    
    <screen name="DefaultOrderPDF">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrder" />
                <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" />

                <script location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderView.groovy" />
                <script location="component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderViewWebSecure.groovy" />
            </actions>
            <widgets>
                <section>
                    <condition>
                        <if-compare operator="equals" value="true" field="hasPermission" />
                    </condition>
                    <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/order/OrderReportHeaderInfo.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/order/OrderReportContactMechs.fo.ftl" />
                                            </xsl-fo>
                                        </platform-specific>
                                        <!-- order items and totals -->
                                        <platform-specific>
                                            <xsl-fo>
                                                <html-template location="component://order/template/order/OrderReportBody.fo.ftl" />
                                            </xsl-fo>
                                        </platform-specific>
                                        <!-- return policies and notes are shown in the last page -->
                                        <platform-specific>
                                            <xsl-fo>
                                                <html-template location="component://order/template/order/OrderReportConditions.fo.ftl" />
                                            </xsl-fo>
                                        </platform-specific>
                                    </widgets>
                                </section>
                            </decorator-section>
                        </decorator-screen>
                    </widgets>
                </section>
            </widgets>
        </section>
    </screen>
    
    <screen name="CompanyLogo">
        <section>
            <actions>
                <script location="component://order/src/main/groovy/org/apache/ofbiz/order/order/CompanyHeader.groovy"/>
            </actions>
            <widgets>
                <platform-specific><xsl-fo><html-template location="component://order/template/order/CompanyHeader.fo.ftl"/></xsl-fo></platform-specific>
            </widgets>
        </section>
    </screen>
    <screen name="ReturnPDF">
        <section>
            <actions>
                <set field="titleProperty" value="OrderOrderReturn"/>
                <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"/>
                <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHeader.groovy"/>
                <script location="component://order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnItems.groovy"/>
            </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/return/ReturnReportHeaderInfo.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/return/ReturnReportContactMechs.fo.ftl"/></xsl-fo>
                                </platform-specific>
                                <!-- order items and totals -->
                                <platform-specific>
                                    <xsl-fo><html-template location="component://order/template/return/ReturnReportBody.fo.ftl"/></xsl-fo>
                                </platform-specific>
                                <!-- return policies and notes are shown in the last page -->
                                <platform-specific>
                                    <xsl-fo><html-template location="component://order/template/return/ReturnReportConditions.fo.ftl"/></xsl-fo>
                                </platform-specific>
                            </widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="ShipGroupsPDF">
        <section>
            <actions>
                <set field="titleProperty" value="OrderShipGroups"/>
                <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/>
                <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
                <script location="component://order/src/main/groovy/org/apache/ofbiz/order/order/ShipGroups.groovy"/>
            </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>
                    <decorator-section name="body">
                        <section>
                            <widgets>
                                <platform-specific>
                                    <xsl-fo><html-template location="component://order/template/order/ShipGroups.fo.ftl"/></xsl-fo>
                                </platform-specific>
                            </widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

</screens>
