.dialog.darkgrey_box
  .box.box-shadow
    %h2.box-header Create Submit Request

    %p
      Do you want to submit #{package_link @package, rev: @revision}?

    = form_tag({controller: 'package', action: 'submit_request'}, method: 'post') do
      = hidden_field_tag(:project, @project)
      = hidden_field_tag(:package, @package)
      = hidden_field_tag(:rev, @revision)
      %p
        = label_tag(:sourceproject, 'From source project:')
        %br/
        = text_field_tag(:sourceproject, elide(@project.name, 40), size: 40, disabled: true)
        %br/
        = label_tag(:targetproject, 'To target project:')
        %br/
        = text_field_tag(:targetproject, @tprj, size: 40, disabled: params[:readonly], required: true, |
                         data: { autocomplete_url: url_for(controller: :project, action: :autocomplete_projects), |
                                 requests_url: url_for(controller: :request, action: :list_small), |
                                 develpackage_url: url_for(controller: :package, action: :devel_project) })
        %br/

        - if params[:readonly]
          = hidden_field_tag(:targetproject, @tprj)

        = label_tag(:targetpackage, 'To target package:')
        %br/
        = text_field_tag(:targetpackage, @tpkg, size: 40, disabled: params[:readonly])
        %br/
        - if params[:readonly]
          = hidden_field_tag(:targetpackage, @tpkg)

        = label_tag(:description, 'Description:')
        %br/
        ~ text_area_tag(:description, @description, size: '40x3')
        %br/

        %span.hidden#supersede-display
          = label_tag(:supersede_requests, 'Supersede requests:')
          %br/
          %span#supersede-requests

        %span#sourceupdate-display
          = check_box_tag(:sourceupdate, 'cleanup', @cleanup_source)
          = label_tag(:sourceupdate, 'Remove local package if request is accepted')

      %p.hidden#devel-project-warning
        You are about to bypass the devel project, please submit to
        %b#devel-project-name
        instead.

      = render partial: '/webui/shared/dialog_action_buttons'

= javascript_tag 'setup_request_dialog();'
