<?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="machine-grid-qvm" title="Instrument / Equipment" model="com.axelor.apps.production.db.Machine">
        <field name="machineId" title="ID"/>
        <field name="name"/>
        <field name="brand"/>
        <field name="model"/>
        <field name="serialNumber"/>
        <field name="machineLocation" title="Location" grid-view="machine-location-grid" form-view="machine-location-form"/>
        <field name="machineLocation.parent" title="Location Parent"  grid-view="machine-location-grid" form-view="machine-location-form"/>
        <field name="machineLocation.stockUnity" title="Location Unity"  grid-view="machine-location-grid" form-view="machine-location-form"/>
        <field name="description" title="Description"/>
    </grid>

    <form name="machine-form-qvm" title="Instrument / Equipment" model="com.axelor.apps.production.db.Machine" width="large" onNew="set-qvm-machine-type"
          onLoad="action-record-machine-set-operating-duration">

        <panel name="informationsPanel" colSpan="9">
            <field name="picture" showTitle="false" colSpan="12"  widget="Image"/>
            <field name="serialNumber" colSpan="4" placeholder="Serial Number"/>
            <field name="name" required="true" colSpan="4" placeholder="Name"/>
            <field name="machineOperationType" required="true" title="Type" colSpan="4" placeholder="Operation Type" onChange="machine-operation-type-panel-title-changer"/>
            <!--<panel name="actionPanel" colSpan="6">
              <button name="$operatingDurationBtn" title="Operating duration" colSpan="12" icon="fa-clock-o" widget="info-button"/>
                  </panel>-->
        </panel>

        <panel name="mainPanel" title="">
            <field name="machineId" title="ID" colSpan="4"/>
            <field name="brand" colSpan="4"/>
            <field name="machineLocation" title="Location" colSpan="4" required="true"/>
            <field name="startingDuration" colSpan="4" widget="duration" x-big="true" x-seconds="true"/>
            <field name="setupDuration" colSpan="4" widget="duration" x-big="true" x-seconds="true"/>
            <field name="endingDuration" colSpan="4" widget="duration" x-big="true" x-seconds="true"/>
            <field name="weeklyPlanning" canNew="true"/>
            <field name="description" colSpan="12"/>
        </panel>

    </form>

    <action-view name="manufacturing.equipement.qvm" model="com.axelor.apps.production.db.Machine" title="Instrument / Equipment">
        <view name="machine-grid-qvm" type="grid"/>
        <view name="machine-form-qvm" type="form"/>
        <domain>self.typeSelect = 1 or self.typeSelect = 2</domain>
    </action-view>

    <action-method name="action-operation-set-machine-info">
        <call method="setMachineInfo" class="com.axelor.apps.qvm.web.QvmOperationController"/>
    </action-method>

    <action-record name="set-qvm-machine-type" model="com.axelor.apps.production.db.Machine">
        <field name="statusSelect"  expr="eval: 2"/>
    </action-record>


</object-views>
