datacite/bracco

View on GitHub
app/templates/providers/show/edit.hbs

Summary

Maintainability
Test Coverage
<div class="panel panel-transparent" id="update-member-form">
  <div class="panel-body">
    <div class="col-md-offset-3 form-help-header">
      <h3 class="edit">
        Update
        {{if
          (eq this.model.memberType 'consortium_organization')
          'Organization'
          'Member'
        }}
      </h3>
      {{#each this.flashMessages.queue as |flash|}}
        <FlashMessage @flash={{flash}} />
      {{/each}}
    </div>
    <BsForm
      @formLayout="horizontal"
      class="form-horizontal"
      @horizontalLabelGridClass="col-md-3"
      @model={{this.model}}
      @onSubmit={{action 'submit' this.model}} as |form|
    >
      <h3 class="member-results">
        Organization Information
      </h3>
      <form.element
        @controlType="text"
        id="member-id"
        class="form-group"
        @label="Member ID"
        @property="symbol"
        @helpText="The Member ID is the unique identifier for each member and can't be changed." as |el|
      >
        <el.control  disabled={{true}} />
      </form.element>
      <form.element
        @controlType="power-select"
        id="ror-id"
        class="form-group"
        @label="Organization identifier (optional)"
        @property="rorId"
        @optionLabelPath="rorId"
        @options={{this.organizations}}
        @destination={{this.rorId}}
        @helpText="Organization identifiers are provided by the Research Organization Registry (ROR)." as |el|
      >
        <el.control
          @onChange={{action 'selectRor'}}
          @search={{action 'searchRor'}}
          @placeholder="Select Organization"
          @searchPlaceholder="Type to search..."
          @allowClear={{true}}
          @searchEnabled={{true}} as |item|
        >
          {{if item.name item.name this.model.rorId}}
        </el.control>
      </form.element>
      {{#if (can 'create provider')}}
        <form.element
          @controlType="text"
          id="salesforce-id"
          class="form-group"
          @label="Salesforce ID"
          @property="salesforceId"
          @helpText="The 18 digit ID in Salesforce."
        />
      {{/if}}
      {{#if (can 'token provider')}}
        <form.element
          @controlType="text"
          id="globus-uuid"
          class="form-group"
          @label="Globus UUID (optional)"
          @property="globusUuid"
          @helpText="The Globus UUID used for token authentication."
        />
      {{/if}}
      {{#if (can 'create provider')}}
        <form.element
          @controlType="power-select"
          id="member-type"
          class="form-group"
          @label="Member Type"
          @property="memberType"
          @options={{this.memberTypes}}
          @destination={{this.memberType}} as |el|
        >
          <el.control
            @onChange={{action 'selectMemberType'}}
            @search={{action 'searchMemberType'}}
            @placeholder="Select Member Type"
            @searchPlaceholder="Type to search..."
            @searchEnabled={{true}}
            disabled={{eq this.model.memberType 'developer'}} as |item|
          >
            {{titleize (humanize item)}}
          </el.control>
        </form.element>
        <form.element
          @controlType="power-select"
          id="tax-status"
          class="form-group"
          @label="Tax Status"
          @property="nonProfitStatus"
          @options={{this.nonProfitStatuses}}
          @destination={{this.nonProfitStatus}} as |el|
        >
          <el.control
            @onChange={{action 'selectNonProfitStatus'}}
            @search={{action 'searchNonProfitStatus'}}
            @placeholder="Tax Status"
            @searchPlaceholder="Type to search..."
            @searchEnabled={{true}} as |item|
          >
            {{titleize item}}
          </el.control>
        </form.element>
        {{#if (eq this.model.memberType 'consortium_organization')}}
          <form.element
            @controlType="power-select"
            class="form-group"
            @property="consortium"
            @label="Consortium"
            @helpText="Consortium for this organization."
            @optionLabelPath="name"
            @options={{this.consortia}}
            @destination={{this.consortium.id}} as |el|
          >
            <el.control
              @onChange={{action 'selectConsortium'}}
              @search={{action 'searchConsortium'}}
              @searchField="name"
              @searchPlaceholder="Type to search..."
              @searchEnabled={{true}} as |item|
            >
              {{item.name}}
            </el.control>
          </form.element>
        {{/if}}
      {{/if}}
      <form.element
        @controlType="text"
        id="name"
        class="form-group"
        @label="{{if
            (eq this.model.memberType 'consortium_organization')
            'Organization'
            'Member'
          }}
           Name"
        @property="name"
        @helpText="The official name of your organization."
      />
      <form.element
        @controlType="text"
        id="display-name"
        class="form-group"
        @label="{{if
            (eq this.model.memberType 'consortium_organization')
            'Organization'
            'Member'
          }}
           Display Name"
        @property="displayName"
        @helpText="Name of your organization as you would like it to appear in Fabrica and on DataCite’s website."
      />
      {{#if (eq this.model.memberType 'consortium_organization')}}
        {{#if this.features.enableDoiEstimate}}
          <form.element
            @controlType="text"
            id="doi-estimate"
            class="form-group"
            @label="Estimated DOIs"
            @property="doiEstimate"
            required
            @helpText={{html-safe (concat "Enter the number of DOIs expected to be registered annually. This amount will be pro-rated for the remaining months of the year. If the consortium fee cap applies enter zero (0). See more details in our <a href='" (get (links) "FEE_MODEL_URL" ) "' target='_blank'>fee model</a>.")}} as |el|
          >
            <el.control id="doi-estimate-field" placeholder="0" />
          </form.element>
        {{/if}}
      {{/if}}
      <form.element
        @controlType="text"
        id="system-email"
        class="form-group"
        @label="System Email"
        @property="systemEmail"
        @helpText="This is the email used for sending password reset requests and similar system notifications."
      />
      <form.element
        @controlType="text"
        id="group-email"
        class="form-group"
        @label="Group Email (optional)"
        @property="groupEmail"
        @helpText="A generic shared email address (such as info@datacite.org or similar) where you would like to receive communications from DataCite."
      />
      <form.element
        @controlType="text"
        id="website"
        class="form-group"
        @label="Website (optional)"
        @property="website"
        @helpText="Website of the member."
      />
      <form.element
        @controlType="text"
        id="twitter-handle"
        class="form-group"
        @label="Twitter (optional)"
        @property="twitterHandle"
        @helpText="DataCite will follow you on Twitter." as |el|
      >
        <el.control id="twitter-handle-field" placeholder="Add @twitter account" />
      </form.element>
      <form.element
        @controlType="power-select"
        id="country"
        class="form-group"
        @label="Country (optional)"
        @property="country"
        @optionLabelPath="name"
        @options={{this.countries}}
        @destination={{this.country}}
        @helpText="Country where the member is located." as |el|
      >
        <el.control
          @onChange={{action 'selectCountry'}}
          @search={{action 'searchCountry'}}
          @searchField="name"
          @placeholder="Select Country"
          @searchPlaceholder="Type to search..."
          @allowClear={{true}}
          @searchEnabled={{true}} as |item|
        >
          {{item.name}}
        </el.control>
      </form.element>
      <form.element
        @controlType="power-select"
        id="organization-type"
        class="form-group"
        @label="Organization Type (optional)"
        @property="organizationType"
        @options={{this.organizationTypes}}
        @destination={{this.organizationType}} as |el|
      >
        <el.control
          @onChange={{action 'selectOrganizationType'}}
          @search={{action 'searchOrganizationType'}}
          @placeholder="Select Organization Type"
          @searchPlaceholder="Type to search..."
          @allowClear={{true}}
          @searchEnabled={{true}} as |item|
        >
          {{titleize (humanize (underscore item))}}
        </el.control>
      </form.element>
      <form.element
        @controlType="power-select"
        id="focus-area"
        class="form-group"
        @label="Focus Area (optional)"
        @property="focusArea"
        @options={{this.focusAreas}}
        @destination={{this.focusArea}}
        @helpText="Field of research covered by the member." as |el|
      >
        <el.control
          @onChange={{action 'selectFocusArea'}}
          @search={{action 'searchFocusArea'}}
          @placeholder="Select Focus Area"
          @searchPlaceholder="Type to search..."
          @allowClear={{true}}
          @searchEnabled={{true}} as |item|
        >
          {{titleize (humanize (underscore item))}}
        </el.control>
      </form.element>
      <form.element
        @controlType="textarea"
        id="description"
        class="form-group"
        @label="Description (optional)"
        @property="description"
        @helpText="Description of the member. Please use markdown for formatting." as |el|
      >
        <el.control rows={{10}} />
      </form.element>
      {{#if (not-eq this.model.memberType 'consortium_organization')}}
        <label class="control-label col-md-3">
          Logo
        </label>
        <div class="col-md-9 form-help-header">
          <div class="btn-toolbar btn-sm btn-file">
            <FileUpload
              @name="files"
              @id="upload-file"
              @multiple={{false}}
              @accept="image/png,image/jpeg"
              @onfileadd={{action 'didSelectFiles'}}
            >
              <span class="btn btn-sm">
                <i class="fas fa-upload"></i>
                {{if this.model.logo 'Replace' 'Upload'}}
                Logo
              </span>
            </FileUpload>
          </div>
          <div class="help-block">
            Please upload your horizontal logo in either png or jpeg format. It will be proportionally resized to be no larger than 500 x 200 px.
          </div>
        </div>
      {{/if}}
      {{#if (not-eq this.model.memberType 'developer')}}
        <h3 class="member-results">
          Contact Information
        </h3>
        {{#if (is-empty this.model.contacts)}}
          <div class="col-md-9 col-md-offset-3">
            <BsAlert @dismissible={{false}} @type="danger">
              There are no contacts in your contacts list. Please
              <LinkTo
                @route="providers.show.contacts.new"
                @model={{this.model.id}}
                id="add-contact"
              >
                add at least one contact
              </LinkTo>
              .
            </BsAlert>
          </div>
        {{else}}
          <div class="col-md-9 col-md-offset-3">
            <BsAlert @dismissible={{false}} @type="info">
              Contacts are created
              <LinkTo @route="providers.show.contacts" @model={{this.model.id}}>
                in the contacts section
              </LinkTo>
              and then assigned roles here.
            </BsAlert>
          </div>
          {{#if (not-eq this.model.memberType 'consortium_organization')}}
            <form.element @controlType="power-select" id="voting-contact" class="form-group" @label="Voting Representative" @property="votingContact" @optionLabelPath="name" @options={{this.model.filteredContacts}} @helpText="Your organization's voting representative." @destination={{this.votingContact}} as |el|>
              <el.control
                @searchEnabled={{false}}
                @search={{action 'searchContact'}}
                @searchField="name"
                @searchPlaceholder="Search contact..."
                @onChange={{action 'selectVotingContact'}}
                @placeholder="Select Contact" as |item|
              >
                {{item.displayName}}
              </el.control>
            </form.element>
          {{/if}}
          <form.element @controlType="power-select" id="service-contact" class="form-group" @label="Service Contact" @property="serviceContact" @optionLabelPath="displayName" @options={{this.model.filteredContacts}} @helpText="Your organization's service contact." @destination={{this.serviceContact}} as |el|>
            <el.control
              @searchEnabled={{false}}
              @search={{action 'searchContact'}}
              @searchField="name"
              @searchPlaceholder="Search contact..."
              @onChange={{action 'selectServiceContact'}}
              @placeholder="Select Contact" as |item|
            >
              {{item.displayName}}
            </el.control>
          </form.element>
          <form.element @controlType="power-select" id="secondary-service-contact" class="form-group" @label="Secondary Service Contact" @property="secondaryServiceContact" @optionLabelPath="name" @options={{this.model.filteredContacts}} @helpText="Your organization's secondary service contact." @destination={{this.secondaryServiceContact}} as |el|>
            <el.control
              @searchEnabled={{false}}
              @search={{action 'searchContact'}}
              @searchField="name"
              @searchPlaceholder="Search contact..."
              @onChange={{action 'selectSecondaryServiceContact'}}
              @placeholder="Select Contact"
              @allowClear={{true}} as |item|
            >
              {{item.displayName}}
            </el.control>
          </form.element>
          <form.element @controlType="power-select" id="technical-contact" class="form-group" @label="Technical Contact" @property="technicalContact" @optionLabelPath="name" @options={{this.model.filteredContacts}} @helpText="Your organization's technical contact." @destination={{this.technicalContact}} as |el|>
            <el.control
              @searchEnabled={{false}}
              @search={{action 'searchContact'}}
              @searchField="name"
              @searchPlaceholder="Search contact..."
              @onChange={{action 'selectTechnicalContact'}}
              @placeholder="Select Contact"
              @allowClear={{true}} as |item|
            >
              {{item.displayName}}
            </el.control>
          </form.element>
          <form.element @controlType="power-select" id="secondary-technical-contact" class="form-group" @label="Secondary Technical Contact" @property="secondaryTechnicalContact" @optionLabelPath="name" @options={{this.model.filteredContacts}} @helpText="Your organization's secondary technical contact." @destination={{this.secondaryTechnicalContact}} as |el|>
            <el.control
              @searchEnabled={{false}}
              @search={{action 'searchContact'}}
              @searchField="name"
              @searchPlaceholder="Search contact..."
              @onChange={{action 'selectSecondaryTechnicalContact'}}
              @placeholder="Select Contact"
              @allowClear={{true}} as |item|
            >
              {{item.displayName}}
            </el.control>
          </form.element>
          {{#if (not-eq this.model.memberType 'consortium_organization')}}
            <form.element @controlType="power-select" id="billing-contact" class="form-group" @label="Billing Contact" @property="billingContact" @optionLabelPath="name" @options={{this.model.filteredContacts}} @helpText="Your organization's billing contact." @destination="billingContact" as |el|>
              <el.control
                @searchEnabled={{false}}
                @search={{action 'searchContact'}}
                @searchField="name"
                @searchPlaceholder="Search contact..."
                @onChange={{action 'selectBillingContact'}}
                @placeholder="Select Contact" as |item|
              >
                {{item.displayName}}
              </el.control>
            </form.element>
            <form.element @controlType="power-select" id="secondary-billing-contact" class="form-group" @label="Secondary Billing Contact" @property="secondaryBillingContact" @optionLabelPath="name" @options={{this.model.filteredContacts}} @helpText="Your organization's secondary billing contact." @destination={{this.secondaryBillingContact}} as |el|>
              <el.control
                @searchEnabled={{false}}
                @search={{action 'searchContact'}}
                @searchField="name"
                @searchPlaceholder="Search contact..."
                @onChange={{action 'selectSecondaryBillingContact'}}
                @placeholder="Select Contact"
                @allowClear={{true}} as |item|
              >
                {{item.displayName}}
              </el.control>
            </form.element>
          {{/if}}
        {{/if}}
      {{/if}}
      {{#if
        (and
          (not-eq this.model.memberType 'consortium_organization')
          (not-eq this.model.memberType 'developer')
        )
      }}
        <h3 class="member-results">
          Billing Information
        </h3>
        <form.element
          @controlType="text"
          id="billing-information-department"
          class="form-group"
          @label="Billing Department"
          @property="billingInformation.department"
          @helpText="Your organization's specific department that is responsible for payment"
        />
        <form.element
          @controlType="text"
          id="billing-information-organization"
          class="form-group"
          @label="Billing Organization"
          @property="billingInformation.organization"
          @helpText="Your organization's name for billing purposes if different from the official name"
        />
        <form.element
          @controlType="text"
          id="billing-information-street"
          class="form-group"
          @label="Billing Street"
          @property="billingInformation.address"
          @helpText="Your organization's street for billing purposes"
        />
        <form.element
          @controlType="text"
          id="billing-information-city"
          class="form-group"
          @label="Billing City"
          @property="billingInformation.city"
          @helpText="Your organization's city for billing purposes"
        />
        <form.element
          @controlType="text"
          id="billing-information-postcode"
          class="form-group"
          @label="Billing Zip/Post Code"
          @property="billingInformation.postCode"
          @helpText="Your organization's Zip/post code for billing purposes"
        />
        <form.element
          @controlType="power-select"
          id="billing-information-country"
          class="form-group"
          @label="Billing Country"
          @property="billingInformation.country"
          @optionLabelPath="name"
          @options={{this.countries}}
          @helpText="Your organization's country for billing purposes."
          @destination={{this.billingInformation.country}} as |el|
        >
          <el.control
            @onChange={{action 'selectBillingCountry'}}
            @search={{action 'searchCountry'}}
            @searchField="name"
            @placeholder="Select Country"
            @searchPlaceholder="Type to search..."
            @allowClear={{true}}
            @searchEnabled={{true}} as |item|
          >
            {{item.name}}
          </el.control>
        </form.element>
        {{#if this.showStateSearch}}
          <form.element
            @controlType="power-select"
            id="billing-information-state"
            class="form-group"
            @label="Billing State/Province"
            @property="billingInformation.state"
            @optionLabelPath="name"
            @options={{this.states}}
            @helpText="Your organization's state/province for billing purposes."
            @destination={{this.billingInformation.country}} as |el|
          >
            <el.control
              @onChange={{action 'selectBillingState'}}
              @search={{action 'searchState'}}
              @searchField="name"
              @placeholder="Select State/Province"
              @searchPlaceholder="Type to search..."
              @allowClear={{true}}
              @searchEnabled={{true}} as |item|
            >
              {{item.name}}
            </el.control>
          </form.element>
        {{/if}}
      {{/if}}
      {{#if (can 'create provider')}}
        <form.element
          @controlType="checkbox"
          id="is-active"
          class="form-group"
          @label="Account is active"
          @property="isActive"
          @helpText="This account can manage repositories and prefixes" as |el|
        >
          <el.control id="is-active-field" />
        </form.element>
      {{/if}}
      <div class="col-md-9 col-md-offset-3">
        <BsAlert @dismissible={{false}} @type="warning">
          The contacts entered may receive notifications about administration, webinars, product testing,
          or news that will impact the use of DataCite services and/or membership. Individuals may remove
          themselves from mailings by following the unsubscribe link provided in every DataCite email.
          For information about our privacy practices and commitment to protecting your privacy, please
          review our
          <a
            target="_blank" rel="noopener noreferrer" href={{get (links) "PRIVACY_POLICY_URL" }}
          >
            Privacy Policy
          </a>
          .
        </BsAlert>
      </div>
      <div class="col-md-9 col-md-offset-3">
        {{#if (is-empty (provider-form-errors this.model))}}
          <button
            type="submit"
            id="update-provider"
            class="btn btn-sm btn-fill"
            disabled={{false}}
          >
            Update
            {{if
              (eq this.model.memberType 'consortium_organization')
              'Organization'
              'Member'
            }}
          </button>
        {{else}}
          <BsAlert @dismissible={{false}} @type="danger">
            To save this
            {{if
              (eq this.model.memberType 'consortium_organization')
              'organization,'
              'member,'
            }}
            first resolve the errors with these fields:
            {{provider-form-errors this.model}}
            .
          </BsAlert>
          <button
            type="submit"
            id="update-provider"
            class="btn btn-sm btn-fill"
            disabled={{true}}
          >
            Update
            {{if
              (eq this.model.memberType 'consortium_organization')
              'Organization'
              'Member'
            }}
          </button>
        {{/if}}
        <button class="btn btn-sm" id="cancel" type="button" {{action 'cancel' this.model}}>
          Cancel
        </button>
      </div>
    </BsForm>
  </div>
</div>