 kd                 = require 'kd'
 JView              = require 'app/jview'
+remote             = require('app/remote').getInstance()
 KDButtonView       = kd.ButtonView
 KDTimeAgoView      = kd.TimeAgoView
 KDListItemView     = kd.ListItemView

        loader   : color : '#4a4e52'
        callback : @bound 'revoke'

      @settings.addSubView new KDButtonView
        cssClass : 'solid compact outline'
        title    : 'RESEND INVITATION'


  pistachio: ->

        duration : 5000


  resend: ->

    return  unless @getOptions().statusType is 'pending'

    @resendButton.showLoader()

    remote.api.JInvitation.sendInvitationByCode @getData().code, (err) =>
      @resendButton.hideLoader()
      title    = 'Invitation is resent.'
      duration = 5000

      if err
        title  = 'Unable to resend the invitation. Please try again.'

      return new KDNotificationView { title, duration }


  createViews: ->

    { hash, createdAt } = @getData()
