text: import UserToken from '@admin/tokens/user'
  import Form from '@admin/components/form'
  import PropTypes from 'prop-types'
  import React from 'react'
  
  class Edit extends React.Component {
  
    static contextTypes = {
      admin: PropTypes.object,
      configuration: PropTypes.object,
      modal: PropTypes.object
    }
  
    static propTypes = {
      user: PropTypes.object
    }
  
    _handleCancel = this._handleCancel.bind(this)
    _handleSuccess = this._handleSuccess.bind(this)
  
    render() {
      return <Form { ...this._getForm() } />
    }
  
    _getForm() {
      const { user } = this.props
      const { configuration } = this.context
      return {
        title: 't(Edit User)',
        method: 'patch',
        endpoint: `/api/admin/team/users/${user.id}/edit`,
        action: `/api/admin/team/users/${user.id}`,
        onCancel: this._handleCancel,
        onSuccess: this._handleSuccess,
        sections: [
          {
            fields: [
              { label: 'Notification Method', name: 'email_notifications_method', type: 'lookup', placeholder: 'Choose a notification method', options: [
                { value: 'none', text: 't(None)' },
                { value: 'ondemand', text: 't(On Demand)' },
                { value: 'digest', text: 't(Daily Digest)' }
              ] },
              { label: 't(Roles)', name: 'role_ids', type: 'lookup2', placeholder: 'Assign roles', multiple: true, endpoint: '/api/admin/team/roles', valueKey: 'id', textKey: 'title' },
              { label: 't(Groups)', name: 'group_ids', type: 'lookup2', placeholder: 'Assign groups', multiple: true, endpoint: '/api/admin/team/groups', valueKey: 'id', textKey: 'title' }
            ]
          },
          ...configuration.appUserFields.reduce((values, appUserFields) => [
            ...values,
            ...appUserFields
          ], [])
        ]
      }
    }
  
    _handleCancel() {
      this.context.modal.close()
    }
  
    _handleSuccess() {
      this.context.modal.close()
    }
  
  }
  
  export default Edit
  