<?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="FindEmployee">
        <section>
            <actions>
                <set field="titleProperty" value="${uiLabelMap.CommonFind} ${uiLabelMap.HumanResEmployee}"/>
                <set field="headerItem" value="Employees"/>
                <set field="helpAnchor" value="_find_employees"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="pre-body">
                        <include-menu name="MainActionMenu" location="${parameters.mainMenuLocation}"/>
                    </decorator-section>
                    <decorator-section name="body">
                        <section>
                            <actions>
                                <service service-name="findParty" auto-field-map="true"/>
                                <set field="tabButtonItem" value="Employee"/>
                            </actions>
                            <widgets>
                                <section>
                                    <widgets>
                                        <platform-specific>
                                            <html><html-template multi-block="true" location="component://humanres/template/FindEmployee.ftl"/></html>
                                        </platform-specific>
                                    </widgets>
                                </section>
                            </widgets>
                            <fail-widgets>
                                <label style="h3">${uiLabelMap.PartyMgrViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="NewEmployee">
        <section>
            <actions>
                <set field="titleProperty" value="PartyCreateNewEmployee"/>
                <set field="headerItem" value="Employees"/>
                <set field="helpAnchor" value="_create_new_employee"/>
                <set field="dependentForm" value="AddEmployee"/>
                <set field="paramKey" value="countryGeoId"/>
                <set field="mainId" value="countryGeoId"/>
                <set field="dependentId" value="stateProvinceGeoId"/>
                <set field="requestName" value="getAssociatedStateList"/>
                <set field="responseName" value="stateList"/>
                <set field="dependentKeyName" value="geoId"/>
                <set field="descName" value="geoName"/>
                <set field="selectedDependentOption" from-field="country.geo.id.default" default-value="USA"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet title="${uiLabelMap.HumanResNewEmployee}">
                        <platform-specific>
                            <html>
                                <html-template location="component://common-theme/template/includes/SetDependentDropdownValuesJs.ftl"/>
                            </html>
                        </platform-specific>
                            <section>
                                <widgets>
                                    <include-form name="AddEmployee" location="component://humanres/widget/forms/EmployeeForms.xml"/>
                                </widgets>
                            </section>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EmployeeProfile">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleViewPartyProfile"/>
                <set field="tabButtonItem" value="EmployeeProfile"/>
                <set field="helpAnchor" value="_employee_profile"/>
                <set field="labelTitleProperty" value="PartyTaxAuthInfos"/>
                <set field="partyId" from-field="parameters.partyId"/>
                <set field="layoutSettings.javaScripts[]" value="/partymgr/static/PartyProfileContent.js" global="true"/>
                <script location="component://party/src/main/groovy/org/apache/ofbiz/party/party/ViewProfile.groovy"/>
                <script location="component://party/src/main/groovy/org/apache/ofbiz/party/party/GetUserLoginPrimaryEmail.groovy"/>
            </actions>
            <widgets>
                <decorator-screen name="EmployeeDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <not><if-empty field="party"/></not>
                            </condition>
                            <widgets>
                                <section>
                                    <condition>
                                        <if-compare field="showOld" operator="equals" value="true" type="Boolean"/>
                                    </condition>
                                    <widgets>
                                        <container style="button-bar button-style-2">
                                            <link target="viewprofile" text="${uiLabelMap.PartyHideOld}">
                                                <parameter param-name="partyId" from-field="party.partyId"/>
                                            </link>
                                        </container>
                                    </widgets>
                                    <fail-widgets>
                                        <container style="button-bar button-style-2">
                                            <link target="viewprofile" text="${uiLabelMap.PartyShowOld}">
                                                <parameter param-name="partyId" from-field="party.partyId"/>
                                                <parameter param-name="SHOW_OLD" value="true"/>
                                            </link>
                                        </container>
                                    </fail-widgets>
                                </section>
                                <section>
                                    <widgets>
                                        <container style="profile-left">
                                            <include-screen name="Party" location="component://party/widget/partymgr/ProfileScreens.xml"/>
                                            <include-screen name="Contact" location="component://party/widget/partymgr/ProfileScreens.xml"/>
                                            <include-screen name="contactsAndAccounts" location="component://party/widget/partymgr/ProfileScreens.xml"/>
                                            <include-screen name="trainingsList"/>
                                        </container>
                                        <container style="profile-right">
                                            <include-screen name="CurrentEmploymentData" location="component://humanres/widget/EmployeeScreens.xml"/>
                                            <include-screen name="UserLogin" location="component://party/widget/partymgr/ProfileScreens.xml"/>
                                            <include-screen name="Attributes" location="component://party/widget/partymgr/ProfileScreens.xml"/>
                                            <include-screen name="Content" location="component://party/widget/partymgr/ProfileScreens.xml"/>
                                            <include-screen name="Notes" location="component://party/widget/partymgr/ProfileScreens.xml"/>
                                        </container>
                                    </widgets>
                                </section>
                            </widgets>
                            <fail-widgets>
                                <container>
                                    <label style="h3">${uiLabelMap.PartyNoPartyFoundWithPartyId}: ${parameters.partyId}</label>
                                </container>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditEmployeeSkills">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleViewPartySkill"/>
                <set field="tabButtonItem" value="EditEmployeeSkills"/>
                <set field="helpAnchor" value="_employee_skills"/>
                <set field="partyId" from-field="parameters.partyId"/>
                <set field="skillTypeId" from-field="parameters.skillTypeId"/>
                <set field="partySkillsCtx.partyId" from-field="parameters.partyId"/>
                <set field="parameters.insideEmployee" value="true"/>
            </actions>
            <widgets>
                <decorator-screen name="EmployeeDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet>
                            <include-grid name="ListEmployeeSkills" location="component://humanres/widget/forms/EmployeeForms.xml"/>
                        </screenlet>
                        <screenlet id="AddPartySkillPanel" title="${uiLabelMap.HumanResAddPartySkill}" collapsible="true">
                            <include-form name="AddEmployeeSkills" location="component://humanres/widget/forms/EmployeeForms.xml"/>
                        </screenlet>
                     </decorator-section>
                 </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditEmployeeQuals">
        <section>
            <actions>
                <set field="titleProperty" value="HumanResEditPartyQual"/>
                <set field="headerItem" value="Employee"/>
                <set field="helpAnchor" value="_employee_qualifications"/>
                <set field="tabButtonItem" value="EditEmployeeQuals"/>
                <set field="partyId" from-field="parameters.partyId"/>
                <set field="partyQualCtx.partyId" from-field="parameters.partyId"/>
                <set field="parameters.insideEmployee" value="true"/>
            </actions>
            <widgets>
                <decorator-screen name="EmployeeDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet>
                            <include-grid name="ListEmployeeQualification" location="component://humanres/widget/forms/EmployeeForms.xml"/>
                        </screenlet>
                        <screenlet id="AddPartyQualPanel" title="${uiLabelMap.HumanResAddPartyQual}" collapsible="true">
                            <include-form name="AddEmployeeQualification" location="component://humanres/widget/forms/EmployeeForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditEmployeeTrainings">
        <section>
            <actions>
                <set field="tabButtonItem" value="EditEmployeeTrainings"/>
                <set field="helpAnchor" value="_employee_training"/>
            </actions>
            <widgets>
                <decorator-screen name="EmployeeDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet id="TrainingStatus" title="${uiLabelMap.HumanResTrainingStatus}" collapsible="true">
                            <include-grid name="ListTrainingStatus" location="component://humanres/widget/forms/PersonTrainingForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditEmployeeEmploymentApps">
        <section>
            <actions>
                <set field="titleProperty" value="PageTitleViewEmploymentApp"/>
                <set field="tabButtonItem" value="EditEmployeeEmploymentApps"/>
                <set field="referredByPartyId" from-field="parameters.partyId"/>
                <set field="employmentAppCtx.applicationId" from-field="parameters.applicationId"/>
                <set field="parameters.insideEmployee" value="true"/>
            </actions>
            <widgets>
                <decorator-screen name="EmployeeDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <include-form name="ListEmploymentApps" location="component://humanres/widget/forms/EmploymentAppForms.xml"/>
                        <screenlet id="AddEmploymentAppPanel" title="${uiLabelMap.CommonAdd} ${uiLabelMap.HumanResEmploymentApp}" collapsible="true">
                            <include-form name="AddEmploymentApp" location="component://humanres/widget/forms/EmploymentAppForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditEmployeeResumes">
        <section>
            <actions>
                <set field="headerItem" value="PartyResume"></set>
                <set field="tabButtonItem" value="EditEmployeeResumes"/>
                <set field="resumeId" from-field="parameters.resumeId"/>
                <set field="partyId" from-field="parameters.partyId"/>
                <entity-one entity-name="PartyResume" value-field="partyResume"/>
            </actions>
            <widgets>
                <decorator-screen name="EmployeeDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <include-form name="ListPartyResumes" location="component://humanres/widget/forms/PartyResumeForms.xml"/>
                        <screenlet id="AddEmploymentAppPanel" title="${uiLabelMap.CommonAdd} ${uiLabelMap.HumanResEditPartyResume}" collapsible="true">
                            <include-form name="EditPartyResume" location="component://humanres/widget/forms/PartyResumeForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditEmployeePerformanceNotes">
        <section>
            <actions>
                <set field="titleProperty" value="HumanResPerfNote"/>
                <set field="tabButtonItem" value="EditEmployeePerformanceNotes"/>
                <set field="partyId" from-field="parameters.partyId"/>
            </actions>
            <widgets>
                <decorator-screen name="EmployeeDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <include-form name="ListPerformanceNotes" location="component://humanres/widget/forms/EmploymentForms.xml"/>
                        <screenlet id="AddPerformanceNotePanel" title="${uiLabelMap.HumanResAddPerfNote}" collapsible="true">
                            <include-form name="AddPerformanceNote" location="component://humanres/widget/forms/EmploymentForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="EditEmployeeLeaves">
        <section>
            <actions>
                <set field="titleProperty" value="HumanResEditEmplLeave"/>
                <set field="tabButtonItem" value="EditEmployeeLeaves"/>
                <set field="helpAnchor" value="_employee_leave"/>
                <set field="partyId" from-field="parameters.partyId"/>
                <entity-one entity-name="EmplLeave" value-field="leaveApp"/>
            </actions>
            <widgets>
                <decorator-screen name="EmployeeDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet>
                            <include-grid name="ListEmplLeaves" location="component://humanres/widget/forms/EmployeeForms.xml"/>
                        </screenlet>
                        <screenlet id="AddEmplLeavePanel" title="${uiLabelMap.HumanResAddEmplLeave}" collapsible="true">
                            <include-form name="AddEmplLeave" location="component://humanres/widget/forms/EmployeeForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="CurrentEmploymentData">
        <section>
            <actions>
                <service service-name="getCurrentPartyEmploymentData" auto-field-map="true" result-map="employmentData"/>
            </actions>
            <widgets>
                <screenlet title="${uiLabelMap.HumanResCurrentEmploymentData}">
                    <include-form name="CurrentEmploymentData" location="component://humanres/widget/forms/EmployeeForms.xml"/>
                </screenlet>
            </widgets>
        </section>
    </screen>
    <screen name="trainingsList">
        <section>
            <widgets>
                <screenlet title="${uiLabelMap.HumanResTrainings}">
                    <include-grid name="SimpleListTrainingStatus" location="component://humanres/widget/forms/PersonTrainingForms.xml"/>
                </screenlet>
            </widgets>
        </section>
    </screen>
    <screen name="PayrollHistory">
        <section>
            <actions>
                <set field="titleProperty" value="HumanResPayRollHistory"/>
                <set field="tabButtonItem" value="PayrollHistory"/>
                <set field="helpAnchor" value="_payroll_history"/>
                <set field="partyId" from-field="parameters.partyId"/>
                <set field="parameters.sortField" from-field="parameters.sortField" default-value="invoiceDate DESC"/>
                <entity-condition entity-name="InvoiceAndType" list="payroll">
                    <condition-list combine="and">
                        <condition-expr field-name="partyIdFrom" operator="equals" from-field="partyId"/>
                        <condition-expr field-name="invoiceTypeId" operator="equals" value="PAYROL_INVOICE"/>
                    </condition-list>
                    <order-by field-name="${parameters.sortField}"/>
                </entity-condition>
            </actions>
            <widgets>
                <decorator-screen name="EmployeeDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <screenlet>
                            <include-grid name="PayrollHistoryList" location="component://humanres/widget/forms/EmployeeForms.xml"/>
                        </screenlet>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>
    <screen name="MyLeaveList">
        <section>
            <actions>
                <set field="partyId" from-field="userLogin.partyId"/>
            </actions>
            <widgets>
                <screenlet title="${uiLabelMap.HumanResMyLeaves}" navigation-form-name="ListEmplLeaves">
                    <include-grid name="ListEmplLeaves" location="component://humanres/widget/forms/EmployeeForms.xml"/>
                </screenlet>
            </widgets>
        </section>
    </screen>
    <screen name="MyTrainings">
        <section>
            <actions>
                <set field="partyId" from-field="userLogin.partyId"/>
            </actions>
            <widgets>
                <screenlet title="${uiLabelMap.HumanResMyTrainings}">
                    <include-grid name="ListEmplTrainings" location="component://humanres/widget/forms/PersonTrainingForms.xml"/>
                </screenlet>
            </widgets>
        </section>
    </screen>
</screens>
