<commit_before>kd               = require 'kd'
React            = require 'kd-react'
List             = require 'app/components/list'


module.exports = class HomeTeamSendInvitesView extends React.Component

  numberOfSections: -> 1


  numberOfRowsInSection: ->

    @props.inputValues?.size or 0


  renderSectionHeaderAtIndex: -> null


  renderRowAtIndex: (sectionIndex, rowIndex) ->

    inviteInput = @props.inputValues.toList().get(rowIndex)
    checked = inviteInput.get('canEdit')

    <div className='kdview invite-inputs'>
      <input type='text' className='kdinput text user-email' placeholder='<EMAIL>' value={inviteInput.get 'email'} onChange={@props.onInputChange.bind(this, rowIndex, 'email')} />
      <input type='text' className='kdinput text firstname' placeholder='Optional' value={inviteInput.get 'firstName'} onChange={@props.onInputChange.bind(this, rowIndex, 'firstName')}/>
      <input type='text' className='kdinput text lastname' placeholder='Optional' value={inviteInput.get 'lastName'} onChange={@props.onInputChange.bind(this, rowIndex, 'lastName')}/>
      <CheckBox
        canEdit={@props.canEdit}
        checked={checked}
        onChange={@props.onInputChange.bind(this, rowIndex, 'canEdit')}
        onClick={@props.onInputChange.bind(null, rowIndex, 'canEdit', { target: { value: not checked}})}/>
    </div>


  renderEmptySectionAtIndex: -> <div> No data found</div>


  render: ->

    <div>
      <InformationLabel canEdit={@props.canEdit} />
      <div className='input-wrapper'>
        <List
          numberOfSections={@bound 'numberOfSections'}
          numberOfRowsInSection={@bound 'numberOfRowsInSection'}
          renderSectionHeaderAtIndex={@bound 'renderSectionHeaderAtIndex'}
          renderRowAtIndex={@bound 'renderRowAtIndex'}
          renderEmptySectionAtIndex={@bound 'renderEmptySectionAtIndex'}
        />
      </div>
      <fieldset className='HomeAppView--ActionBar'>
        <GenericButton
          title='SEND INVITES'
          className={'custom-link-view HomeAppView--button primary fr'}
          callback={@props.onSendInvites}/>
        <GenericButton
          title='UPLOAD CSV'
          className={'custom-link-view HomeAppView--button ft'}
          callback={@props.onUploadCsv} />
      </fieldset>
    </div>


CheckBox = ({ canEdit, checked, onChange, onClick }) ->

  if canEdit
    <div className='kdcustomcheckbox' >
      <input type='checkbox' className='kdinput checkbox' checked={checked} onChange={onChange}/>
      <label onClick={onClick}></label>
    </div>
  else
    <div className='kdcustomcheckbox'></div>


InformationLabel = ({ canEdit }) ->

  lastname = '<NAME>'<commit_msg>myteam: minor change<commit_after>kd               = require 'kd'
React            = require 'kd-react'
List             = require 'app/components/list'


module.exports = class HomeTeamSendInvitesView extends React.Component

  numberOfSections: -> 1


  numberOfRowsInSection: ->

    @props.inputValues?.size or 0


  renderSectionHeaderAtIndex: -> null


  renderRowAtIndex: (sectionIndex, rowIndex) ->

    inviteInput = @props.inputValues.toList().get(rowIndex)
    checked = inviteInput.get('canEdit')

    <div className='kdview invite-inputs'>
      <input type='text' className='kdinput text user-email' placeholder='<EMAIL>' value={inviteInput.get 'email'} onChange={@props.onInputChange.bind(this, rowIndex, 'email')} />
      <input type='text' className='kdinput text firstname' placeholder='Optional' value={inviteInput.get 'firstName'} onChange={@props.onInputChange.bind(this, rowIndex, 'firstName')}/>
      <input type='text' className='kdinput text lastname' placeholder='Optional' value={inviteInput.get 'lastName'} onChange={@props.onInputChange.bind(this, rowIndex, 'lastName')}/>
      <CheckBox
        canEdit={@props.canEdit}
        checked={checked}
        onChange={@props.onInputChange.bind(this, rowIndex, 'canEdit')}
        onClick={@props.onInputChange.bind(null, rowIndex, 'canEdit', { target: { value: not checked}})}/>
    </div>


  renderEmptySectionAtIndex: -> <div> No data found</div>


  render: ->

    <div>
      <InformationLabel canEdit={@props.canEdit} />
      <div className='input-wrapper'>
        <List
          numberOfSections={@bound 'numberOfSections'}
          numberOfRowsInSection={@bound 'numberOfRowsInSection'}
          renderSectionHeaderAtIndex={@bound 'renderSectionHeaderAtIndex'}
          renderRowAtIndex={@bound 'renderRowAtIndex'}
          renderEmptySectionAtIndex={@bound 'renderEmptySectionAtIndex'}
        />
      </div>
      <fieldset className='HomeAppView--ActionBar'>
        <GenericButton
          title='SEND INVITES'
          className={'custom-link-view HomeAppView--button primary fr'}
          callback={@props.onSendInvites}/>
        <GenericButton
          title='UPLOAD CSV'
          className={'custom-link-view HomeAppView--button ft'}
          callback={@props.onUploadCsv} />
      </fieldset>
    </div>


CheckBox = ({ canEdit, checked, onChange, onClick }) ->

  if canEdit
    <div className='kdcustomcheckbox' >
      <input type='checkbox' className='kdinput checkbox' checked={checked} onChange={onChange}/>
      <label onClick={onClick}></label>
    </div>
  else
    <div></div>


InformationLabel = ({ canEdit }) ->

  lastname = '<NAME>'
{'fraction_non_alphanumeric': 0.13927368026956197, 'fraction_numerical': 0.0007487832272557095, 'mean_word_length': 3.467391304347826, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 73, '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': '2892132', 'n_tokens_mistral': 1586, 'n_tokens_neox': 1545, 'n_words': 292}