<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<object-views xmlns="http://axelor.com/xml/ns/object-views"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.2.xsd">
    
    <grid name="lunch-voucher-mgt-line-grid" title="Lunch Voucher Lines" model="com.axelor.apps.hr.db.LunchVoucherMgtLine" editable="true" orderBy="employee">
        <hilite if="statusSelect==2" color="danger"/>
        <field name="employee" width="150"/>
        <field name="canteenEntries" width="150" aggregate="sum" title="Canteen"
               readonlyIf="$get('lunchVoucherMgt.statusSelect') == 4" onChange="action-lunch-voucher-mgt-line-compute"/>
        <field name="daysOverseas" width="150" aggregate="sum" title="Overseas"
               readonlyIf="$get('lunchVoucherMgt.statusSelect') == 4" onChange="action-lunch-voucher-mgt-line-compute"/>
        <field name="invitation" width="150" aggregate="sum" title="Invitation"
               readonlyIf="$get('lunchVoucherMgt.statusSelect') == 4" onChange="action-lunch-voucher-mgt-line-compute"/>
        <field name="inAdvanceNbr" width="150" aggregate="sum" title="Advance"/>
        <field name="lunchVoucherNumber" width="150" aggregate="sum" title="Nbr lunch vouchers"/>
        <field name="givenToEmployee" width="150" title="Given"/>
        <field name="lunchVoucherFormatSelect" width="200"/>
        <field name="statusSelect" width="150"/>
        <field name="lunchVoucherMgt" hidden="true"/>
        <field name="lunchVoucherMgt.statusSelect" hidden="true"/>
        <field name="daysWorkedNbr" hidden="true"/>
    </grid>
    
    <grid name="lunch-voucher-mgt-line-employee-grid" title="Lunch Voucher Lines" model="com.axelor.apps.hr.db.LunchVoucherMgtLine" orderBy="-lunchVoucherMgt.payPeriod.fromDate">
        <field name="lunchVoucherMgt.payPeriod"/>
        <field name="canteenEntries" aggregate="sum" title="Canteen"/>
        <field name="daysOverseas" aggregate="sum" title="Overseas"/>
        <field name="invitation" aggregate="sum" title="Invitation"/>
        <field name="inAdvanceNbr" aggregate="sum" title="Advance"/>
        <field name="lunchVoucherNumber" aggregate="sum" title="Nbr lunch vouchers"/>
        <field name="givenToEmployee" title="Given"/>
        <field name="lunchVoucherMgt.statusSelect"/>
        <field name="lunchVoucherMgt" hidden="true"/>
    </grid>
    
    <grid name="lunch-voucher-mgt-line-payroll-grid" title="Lunch Voucher Lines" model="com.axelor.apps.hr.db.LunchVoucherMgtLine" orderBy="-lunchVoucherMgt.payPeriod.fromDate">
        <field name="lunchVoucherMgt.payPeriod"/>
        <field name="canteenEntries" aggregate="sum" title="Canteen"/>
        <field name="daysOverseas" aggregate="sum" title="Overseas"/>
        <field name="invitation" aggregate="sum" title="Invitation"/>
        <field name="inAdvanceNbr" aggregate="sum" title="Advance"/>
        <field name="lunchVoucherNumber" aggregate="sum" title="Nbr lunch vouchers"/>
        <field name="givenToEmployee" title="Given"/>
        <field name="lunchVoucherMgt" hidden="true"/>
    </grid>

	<form name="lunch-voucher-mgt-line-form" title="Lunch Voucher Line" model="com.axelor.apps.hr.db.LunchVoucherMgtLine" width="large">
		<panel name="overviewPanel" title="Overview">
			<field name="employee" colSpan="6" form-view="employee-form" grid-view="employee-grid" canNew="false" canEdit="false" canView="false"/>
			<field name="lunchVoucherNumber" css="label-bold bold" colSpan="12" />
		</panel>
		<panel name="detailsPanel" title="Details">
			<field name="canteenEntries" colSpan="6"
                   onChange="action-lunch-voucher-mgt-line-compute"
                   readonlyIf="lunchVoucherMgt.statusSelect == 4"/>
			<field name="daysOverseas" colSpan="6"
                   onChange="action-lunch-voucher-mgt-line-compute"
                   readonlyIf="lunchVoucherMgt.statusSelect == 4"/>
			 <field name="invitation" colSpan="6"
                    onChange="action-lunch-voucher-mgt-line-compute"
                    readonlyIf="lunchVoucherMgt.statusSelect == 4"/>
			 <field name="inAdvanceNbr" colSpan="6"/>
			<field name="givenToEmployee" colSpan="6"/>
            <field name="daysWorkedNbr" hidden="true"/>
            <field name="lunchVoucherMgt.statusSelect" hidden="true"/>
		</panel>
		<panel name="commentPanel" title="Comments">
			<field name="comments" colSpan="12" showTitle="false" widget="Text"/>
		</panel>
	</form>
	
	<action-method name="action-lunch-voucher-mgt-line-compute">
		<call class="com.axelor.apps.hr.web.lunch.voucher.LunchVoucherMgtLineController" method="compute"/>
	</action-method>
	
</object-views>