<?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="frequency-grid" title="Frequencies" model="com.axelor.apps.base.db.Frequency">
    <field name="summary"/>
  </grid>

  <form name="frequency-form" title="Frequency" model="com.axelor.apps.base.db.Frequency" width="large" onNew="action-frequency-method-compute-summary">
    <panel>
      <field name="summary" showTitle="false" readonly="true" css="bold" colSpan="12"/>
    </panel>

    <panel>
      <field name="endDate" required="true" onChange="action-frequency-method-compute-summary"/>

      <panel title="Frequency type" colSpan="12">
        <field name="typeSelect" onChange="action-frequency-method-compute-summary"/>
        <panel>
          <field name="everyNWeeks" showIf="typeSelect == 'everyNWeeks'" onChange="action-frequency-method-compute-summary" hidden="true" colSpan="12"/>
          <field name="first" showIf="typeSelect == 'monthDays'" onChange="action-frequency-method-compute-summary" hidden="true" colSpan="2"/>
          <field name="second" showIf="typeSelect == 'monthDays'" onChange="action-frequency-method-compute-summary" hidden="true" colSpan="2"/>
          <field name="third" showIf="typeSelect == 'monthDays'" onChange="action-frequency-method-compute-summary" hidden="true" colSpan="2"/>
          <field name="fourth" showIf="typeSelect == 'monthDays'" onChange="action-frequency-method-compute-summary" hidden="true" colSpan="2"/>
          <field name="last" showIf="typeSelect == 'monthDays'" onChange="action-frequency-method-compute-summary" hidden="true" colSpan="2"/>
        </panel>
      </panel>

      <panel title="Days" colSpan="12" itemSpan="1">
        <field name="monday" onChange="action-frequency-method-compute-summary"/>
        <field name="tuesday" onChange="action-frequency-method-compute-summary"/>
        <field name="wednesday" onChange="action-frequency-method-compute-summary"/>
        <field name="thursday" onChange="action-frequency-method-compute-summary"/>
        <field name="friday" onChange="action-frequency-method-compute-summary"/>
        <field name="saturday" onChange="action-frequency-method-compute-summary"/>
        <field name="sunday" onChange="action-frequency-method-compute-summary"/>
      </panel>

      <panel title="Months" colSpan="12" itemSpan="2">
        <field name="january" onChange="action-frequency-method-compute-summary"/>
        <field name="february" onChange="action-frequency-method-compute-summary"/>
        <field name="march" onChange="action-frequency-method-compute-summary"/>
        <field name="april" onChange="action-frequency-method-compute-summary"/>
        <field name="may" onChange="action-frequency-method-compute-summary"/>
        <field name="june" onChange="action-frequency-method-compute-summary"/>
        <field name="july" onChange="action-frequency-method-compute-summary"/>
        <field name="august" onChange="action-frequency-method-compute-summary"/>
        <field name="september" onChange="action-frequency-method-compute-summary"/>
        <field name="october" onChange="action-frequency-method-compute-summary"/>
        <field name="november" onChange="action-frequency-method-compute-summary"/>
        <field name="december" onChange="action-frequency-method-compute-summary"/>
      </panel>
    </panel>
  </form>

  <action-method name="action-frequency-method-compute-summary">
    <call class="com.axelor.apps.base.web.FrequencyController" method="computeSummary"/>
  </action-method>

</object-views>
