<?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="vehicle-contract-grid" title="Vehicle Contract" model="com.axelor.apps.fleet.db.VehicleContract">
       <field name="vehicle" />
       <field name="startDate" />
       <field name="expiryDate" />
       <field name="typeSelect" />
       <field name="insurerPartner" />
    </grid>
    
    <form name="vehicle-contract-form" title="Vehicle Contract" model="com.axelor.apps.fleet.db.VehicleContract" width="large" >
      <panel name="statusPanel" title="Status">
			<field name="statusSelect" colSpan="12" widget="NavSelect" showTitle="false"/>      	
      </panel>
       <panel name="mainPanel">
     		<field name="name" hidden="true"/>
     		<field name="vehicle" title="Vehicle" onChange="action-fleet-record-fill-contract-name">
		      <editor>
		        <field name="name" colSpan="12"/>
		        <field name="vehicleOdometer"/>
		      </editor>
		    </field>
    		<panel name="contractDetailPanel" title="Contract details" itemSpan="12">
	     		<field name="typeSelect"/>
	     		<field name="activationCost"/>
	     		<field name="costFrequencySelect"/>
	     		<field name="recurringCost" showIf="costFrequencySelect > 0"/>
	   		</panel>
	  		<panel name="datesPanel" itemSpan="12">
	   			<field name="invoiceDate"/>
	   			<field name="startDate"/>
	   			<field name="expiryDate"/>
	   		</panel>
	   		<panel name="partnerPanel" itemSpan="12">
	   			<field name="insurerPartner"/>
	   			<field name="purchaserPartner"/>
	   			<field name="reference"/>
	   		</panel>
	   </panel>
	   <panel-tabs name="mainPanelTab">
			<panel-related name="vehicleServiceListPanel" field="vehicleServiceList" title="Included Services" colSpan="12">
				<field name="serviceType"/>
				<field name="cost"/>
			</panel-related>
			<panel name="termsAndConditionsPanel" title="Terms and Conditions">
				<field name="notes" widget="html" colSpan="12" showTitle="false" />
			</panel>
	   </panel-tabs>
    </form>
    
    <action-record name="action-fleet-record-fill-contract-name" model="com.axelor.apps.fleet.db.VehicleContract">
    	<field name="name" expr="eval: vehicle != null ? vehicle.name : null"/>
    </action-record>
    
</object-views>