<commit_before><link rel="import" href="../../../../../../../bower_components/polymer/polymer-element.html">
<link rel="import" href="../../../../../../../bower_components/etools-dropdown/etools-dropdown.html">
<link rel="import" href="../../../../../../../bower_components/etools-behaviors/etools-mixin-factory.html">

<link rel="import" href="../../../../../scripts/lodash.html">
<link rel="import" href="../../../../../config/app-constants.html">

<link rel="import" href="../../../../../styles/grid-layout-styles.html">
<link rel="import" href="../../../../../styles/shared-styles.html">
<link rel="import" href="../../../../../styles/required-field-styles.html">

<link rel="import" href="../../../../../mixins/event-helper-mixin.html">
<link rel="import" href="../../../../../mixins/common-mixin.html">
<link rel="import" href="../../../../../layout/components/etools-form-element-wrapper.html">
<link rel="import" href="../../../../../redux/etools-data-redux-store.html">

<dom-module id="agreement-selector">
  <template>
    <style include="grid-layout-styles shared-styles required-field-starred-styles">
      #agreement-selector-content {
        padding: 0;
      }

      .no-left-padding {
        padding-left: 0 !important;
      }
    </style>
    <div id="agreement-selector-content" class="row-h flex-c">
      <template is="dom-if" if="[[!permissions.edit.agreement]]">
        <div class="col col-6">
          <etools-form-element-wrapper label="Partner Organization"
                                       required
                                       value="[[intervention.partner]]">
          </etools-form-element-wrapper>
        </div>
        <div class="col col-3">
          <etools-form-element-wrapper label="Partner Vendor Number"
                                       value="[[intervention.partner_vendor]]">
          </etools-form-element-wrapper>
        </div>
        <div class="col col-3">
          <etools-form-element-wrapper label="Agreement"
                                       required
                                       value="[[selectedAgreement.agreement_number]]">
          </etools-form-element-wrapper>
        </div>
      </template>

      <template is="dom-if" if="[[permissions.edit.agreement]]">
        <div class="col col-6 no-left-padding">
          <etools-dropdown id="partner"
                           label="Partner Organization"
                           placeholder="&#8212;"
                           options="[[partnersDropdownData]]"
                           option-value="id"
                           option-label="name"
                           selected="{{partnerId}}"
                           required$="[[permissions.required.agreement]]"
                           auto-validate
                           error-message="Partner is required">
          </etools-dropdown>
        </div>
        <div class="col col-2">
          <etools-form-element-wrapper label="Partner Vendor Number"
                                       value="[[intervention.partner_vendor]]">
          </etools-form-element-wrapper>
        </div>

        <div class="col flex-c">
          <etools-dropdown id="agreements"
                           label="Agreement"
                           placeholder="&#8212;"
                           options="[[filteredAgreements]]"
                           option-value="id"
                           option-label="agreement_number"
                           selected="{{agreementId}}"
                           required$="[[permissions.required.agreement]]"
                           auto-validate
                           error-message="Agreement required">
          </etools-dropdown>

        </div>
      </template>
    </div>
  </template>
  <script>
    'use strict';

    /**
     * @polymer
     * @customElement
     * @appliesMixin EtoolsPmpApp.Mixins.EventHelper
     * @appliesMixin EtoolsPmpApp.Mixins.Common
     * @appliesMixin EtoolsPmpApp.Mixins.EtoolsDataReduxStore<commit_msg>Rename property to agrement_number_status<commit_after><link rel="import" href="../../../../../../../bower_components/polymer/polymer-element.html">
<link rel="import" href="../../../../../../../bower_components/etools-dropdown/etools-dropdown.html">
<link rel="import" href="../../../../../../../bower_components/etools-behaviors/etools-mixin-factory.html">

<link rel="import" href="../../../../../scripts/lodash.html">
<link rel="import" href="../../../../../config/app-constants.html">

<link rel="import" href="../../../../../styles/grid-layout-styles.html">
<link rel="import" href="../../../../../styles/shared-styles.html">
<link rel="import" href="../../../../../styles/required-field-styles.html">

<link rel="import" href="../../../../../mixins/event-helper-mixin.html">
<link rel="import" href="../../../../../mixins/common-mixin.html">
<link rel="import" href="../../../../../layout/components/etools-form-element-wrapper.html">
<link rel="import" href="../../../../../redux/etools-data-redux-store.html">

<dom-module id="agreement-selector">
  <template>
    <style include="grid-layout-styles shared-styles required-field-starred-styles">
      #agreement-selector-content {
        padding: 0;
      }

      .no-left-padding {
        padding-left: 0 !important;
      }
    </style>
    <div id="agreement-selector-content" class="row-h flex-c">
      <template is="dom-if" if="[[!permissions.edit.agreement]]">
        <div class="col col-6">
          <etools-form-element-wrapper label="Partner Organization"
                                       required
                                       value="[[intervention.partner]]">
          </etools-form-element-wrapper>
        </div>
        <div class="col col-3">
          <etools-form-element-wrapper label="Partner Vendor Number"
                                       value="[[intervention.partner_vendor]]">
          </etools-form-element-wrapper>
        </div>
        <div class="col col-3">
          <etools-form-element-wrapper label="Agreement"
                                       required
                                       value="[[selectedAgreement.agreement_number_status]]">
          </etools-form-element-wrapper>
        </div>
      </template>

      <template is="dom-if" if="[[permissions.edit.agreement]]">
        <div class="col col-6 no-left-padding">
          <etools-dropdown id="partner"
                           label="Partner Organization"
                           placeholder="&#8212;"
                           options="[[partnersDropdownData]]"
                           option-value="id"
                           option-label="name"
                           selected="{{partnerId}}"
                           required$="[[permissions.required.agreement]]"
                           auto-validate
                           error-message="Partner is required">
          </etools-dropdown>
        </div>
        <div class="col col-2">
          <etools-form-element-wrapper label="Partner Vendor Number"
                                       value="[[intervention.partner_vendor]]">
          </etools-form-element-wrapper>
        </div>

        <div class="col flex-c">
          <etools-dropdown id="agreements"
                           label="Agreement"
                           placeholder="&#8212;"
                           options="[[filteredAgreements]]"
                           option-value="id"
                           option-label="agreement_number_status"
                           selected="{{agreementId}}"
                           required$="[[permissions.required.agreement]]"
                           auto-validate
                           error-message="Agreement required">
          </etools-dropdown>

        </div>
      </template>
    </div>
  </template>
  <script>
    'use strict';

    /**
     * @polymer
     * @customElement
     * @appliesMixin EtoolsPmpApp.Mixins.EventHelper
     * @appliesMixin EtoolsPmpApp.Mixins.Common
     * @appliesMixin EtoolsPmpApp.Mixins.EtoolsDataReduxStore
{'fraction_non_alphanumeric': 0.17760236803157375, 'fraction_numerical': 0.00370004933399112, 'mean_word_length': 1.5759212198221093, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 99, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5329628', 'n_tokens_mistral': 2194, 'n_tokens_neox': 2065, 'n_words': 306}