<commit_before><%= render "gobierto_admin/shared/validation_errors", resource: @calendar_configuration_form %>

<%= render "gobierto_admin/gobierto_calendars/calendar_configuration/#{@calendar_configuration_form.collection_container_identifier}_navigation", collection_container:  @calendar_configuration_form.collection_container %>

<% if @calendar_configuration_form.calendar_integration.present? %>
  <div class="admin_tools">
    <% if @last_sync.present? %>
      <%= t('.last_sync') %>: <%= time_ago_in_words @last_sync %> -
    <% end %>

    <%= link_to sync_calendars_admin_calendars_configuration_path(@calendar_configuration_form.collection_id), method: :put, data: { confirm: t(".confirm_sync") } do %>
      <i class="fa fa-refresh"></i>
      <%= t('.sync') %>
    <% end %>
  </div>
<% end %>

<%= form_for @calendar_configuration_form, as: :calendar_configuration, url: admin_calendars_configuration_path,  method: :patch do |f| %>
  <div class="pure-g">
    <div class="pure-u-1 pure-u-md-16-24">

      <div id="calendar-integration-picker" class="form_item input_text">
        <%= f.label :calendar_integration, t(".calendar_integration") %>
        <%= f.select :calendar_integration, @calendar_integrations_options, include_blank: true %>
      </div>

      <% integration_name = @calendar_configuration_form.calendar_integration %>

      <%= render 'gobierto_admin/gobierto_calendars/calendar_configuration/ibm_notes_fields', f: f, integration_name: integration_name %>

      <%= render 'gobierto_admin/gobierto_calendars/calendar_configuration/microsoft_exchange_fields', f: f, integration_name: integration_name %>

      <%= render 'gobierto_admin/gobierto_calendars/calendar_configuration/google_calendar_fields', f: f, integration_name: integration_name %>

      <% if integration_name.present? %>
        <div class="option">
          <%= f.check_box :clear_calendar_configuration %>
          <%= f.label :clear_calendar_configuration do %>
            <span></span>
            <%= t('.remove_configuration') %>
          <% end %>
        </div>
      <% end %>

      <h3><%= t('.filter_events') %></h3>

      <p><%= t('.filter_events_desc') %></p>

      <table class="med_bg dynamic-content-wrapper" id="filtering-rules">
        <%= f.fields_for :filtering_rules do |filtering_rule_form| %>
          <tbody class="dynamic-content-record-wrapper content-block-record-<%= filtering_rule_form.object.id || "new" %>">
            <tr class="dynamic-content-record-form">
              <td>
                <div class="inline p_0_5">Si el</div>
                <div class="select_control select_compact inline">
                  <%= filtering_rule_form.select :field, options_for_enum(filtering_rule_form.object, :field), prompt: true %>
                </div>
              </td>
              <td>
                <div class="p_0_5">
                  <div class="select_control select_compact ">
                    <%= filtering_rule_form.select :condition, options_for_enum(filtering_rule_form.object, :condition), prompt: true %>
                  </div>
                </div>
              </td>
              <td>
                <div class="p_0_5">
                  <%= filtering_rule_form.text_field :value, class: "slim" %>
                </div>
              </td>
              <td>
                <div class="p_0_5">
                  <div class="select_control select_compact">
                    <%= filtering_rule_form.select :action, options_for_enum(filtering_rule_form.object, :action), prompt: true %>
                  </div>
                </div>
              </td>
              <td>
                <div class="p_0_5">
                  <%= filtering_rule_form.check_box :_destroy, class: "hidden destroy-content-block-record" %>

                  <%= link_to "#", data: { behavior: "delete_record" } do %>
                    <i class="fa fa-trash"></i>
                  <% end %>
                </div>
              </td>
            </tr>
          </tbody>
        <% end %>

        <tr>
          <td colspan="5">
            <div class="p_1">
              <%= link_to "#", data: { behavior: "add_child" } do %>
                <%== %Q{<i class="fa fa-plus-circle"></i> #{t('.add_rule')}} %>
              <% end %>
            </div>
          </td>
        </tr>
      </table>
    </div>

    <div class="pure-u-1 pure-u-md-2-24"></div>

    <div class="pure-u-1 pure-u-md-1-4 " id="update_button">
      <div class="widget_save stick_in_parent">
        <%= f.submit t('helpers.submit.update'), class: "button" %>
      </div>
    </div>

  </div>
<% end %>

<% content_for :javascript_hook do %>
  <%= javascript_tag do %>
    window.GobiertoAdmin.gobierto_calendars_calendar_configurations_controller.edit("#filtering-rules", "filtering_rules_attributes");<commit_msg>Show filtering rules only when integration is present<commit_after><%= render "gobierto_admin/shared/validation_errors", resource: @calendar_configuration_form %>

<%= render "gobierto_admin/gobierto_calendars/calendar_configuration/#{@calendar_configuration_form.collection_container_identifier}_navigation", collection_container:  @calendar_configuration_form.collection_container %>

<% if @calendar_configuration_form.calendar_integration.present? %>
  <div class="admin_tools">
    <% if @last_sync.present? %>
      <%= t('.last_sync') %>: <%= time_ago_in_words @last_sync %> -
    <% end %>

    <%= link_to sync_calendars_admin_calendars_configuration_path(@calendar_configuration_form.collection.id), method: :put, data: { confirm: t(".confirm_sync") } do %>
      <i class="fa fa-refresh"></i>
      <%= t('.sync') %>
    <% end %>
  </div>
<% end %>

<%= form_for @calendar_configuration_form, as: :calendar_configuration, url: admin_calendars_configuration_path,  method: :patch do |f| %>
  <div class="pure-g">
    <div class="pure-u-1 pure-u-md-16-24">

      <div id="calendar-integration-picker" class="form_item input_text">
        <%= f.label :calendar_integration, t(".calendar_integration") %>
        <%= f.select :calendar_integration, @calendar_integrations_options, include_blank: true %>
      </div>

      <% integration_name = @calendar_configuration_form.calendar_integration %>

      <%= render 'gobierto_admin/gobierto_calendars/calendar_configuration/ibm_notes_fields', f: f, integration_name: integration_name %>

      <%= render 'gobierto_admin/gobierto_calendars/calendar_configuration/microsoft_exchange_fields', f: f, integration_name: integration_name %>

      <%= render 'gobierto_admin/gobierto_calendars/calendar_configuration/google_calendar_fields', f: f, integration_name: integration_name %>

      <% if integration_name.present? %>
        <div class="option">
          <%= f.check_box :clear_calendar_configuration %>
          <%= f.label :clear_calendar_configuration do %>
            <span></span>
            <%= t('.remove_configuration') %>
          <% end %>
        </div>

        <h3><%= t('.filter_events') %></h3>

        <p><%= t('.filter_events_desc') %></p>

        <table class="med_bg dynamic-content-wrapper" id="filtering-rules">
          <%= f.fields_for :filtering_rules do |filtering_rule_form| %>
            <tbody class="dynamic-content-record-wrapper content-block-record-<%= filtering_rule_form.object.id || "new" %>">
              <tr class="dynamic-content-record-form">
                <td>
                  <div class="inline p_0_5">Si el</div>
                  <div class="select_control select_compact inline">
                    <%= filtering_rule_form.select :field, options_for_enum(filtering_rule_form.object, :field), prompt: true %>
                  </div>
                </td>
                <td>
                  <div class="p_0_5">
                    <div class="select_control select_compact ">
                      <%= filtering_rule_form.select :condition, options_for_enum(filtering_rule_form.object, :condition), prompt: true %>
                    </div>
                  </div>
                </td>
                <td>
                  <div class="p_0_5">
                    <%= filtering_rule_form.text_field :value, class: "slim" %>
                  </div>
                </td>
                <td>
                  <div class="p_0_5">
                    <div class="select_control select_compact">
                      <%= filtering_rule_form.select :action, options_for_enum(filtering_rule_form.object, :action), prompt: true %>
                    </div>
                  </div>
                </td>
                <td>
                  <div class="p_0_5">
                    <%= filtering_rule_form.check_box :_destroy, class: "hidden destroy-content-block-record" %>

                    <%= link_to "#", data: { behavior: "delete_record" } do %>
                      <i class="fa fa-trash"></i>
                    <% end %>
                  </div>
                </td>
              </tr>
            </tbody>
          <% end %>

          <tr>
            <td colspan="5">
              <div class="p_1">
                <%= link_to "#", data: { behavior: "add_child" } do %>
                  <%== %Q{<i class="fa fa-plus-circle"></i> #{t('.add_rule')}} %>
                <% end %>
              </div>
            </td>
          </tr>
        </table>
      <% end %>
    </div>

    <div class="pure-u-1 pure-u-md-2-24"></div>

    <div class="pure-u-1 pure-u-md-1-4 " id="update_button">
      <div class="widget_save stick_in_parent">
        <%= f.submit t('helpers.submit.update'), class: "button" %>
      </div>
    </div>

  </div>
<% end %>

<% content_for :javascript_hook do %>
  <%= javascript_tag do %>
    window.GobiertoAdmin.gobierto_calendars_calendar_configurations_controller.edit("#filtering-rules", "filtering_rules_attributes");
{'fraction_non_alphanumeric': 0.14884334415584416, 'fraction_numerical': 0.005275974025974026, 'mean_word_length': 2.322210987529491, 'pattern_counts': {'":': 0, '<': 221, '<?xml version=': 0, '>': 221, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4157207', 'n_tokens_mistral': 3181, 'n_tokens_neox': 2867, 'n_words': 486}