- @pagetitle = "Edit Patchinfo for #{@project}"

.card
  = render partial: 'webui/package/tabs', locals: { project: @project, package: @package }
  .card-body
    %h3= @pagetitle

    = form_for(@patchinfo, url: patchinfo_path(project: @project, package: @package), method: :put, html: { id: 'patchinfo' }) do |form|
      = form.hidden_field(:name)
      .mb-3.col-md-8.col-lg-4
        = render partial: 'webui/shared/search_box', locals: { html_id: 'patchinfo[packager]', label: 'Packager', value: @patchinfo.packager,
                                                                 data: { source: autocomplete_users_path } }
      .mb-3.col-md-6
        = form.label(:summary) do
          Summary
          = render partial: 'webui/shared/required_label_mark'
          %small.form-text Summarize the changes (minimum 10 characters)
        = form.text_area(:summary, required: true, class: 'form-control', minlength: 10)
      .mb-3.col-md-6
        = form.label(:description) do
          Description
          = render partial: 'webui/shared/required_label_mark'
          %small.form-text Fully describe the changes (minimum 50 characters)
        = form.text_area(:description, required: true, rows: 8, class: 'form-control', minlength: 50)
      .mb-3.col-sm-6.col-md-2
        = form.label(:version)
        = form.text_field(:version, class: 'form-control')
      .mb-3.col-md-6
        = form.label(:message)
        = form.text_area(:message, rows: 4, class: 'form-control')
      .mb-3.col-sm-6.col-md-3
        = form.label(:category)
        = form.select(:category, options_for_select(Patchinfo::CATEGORIES, @patchinfo.category), {}, class: 'form-select')
      .mb-3.col-sm-6.col-md-3
        = form.label(:rating)
        = form.select(:rating, options_for_select(Patchinfo::RATINGS, @patchinfo.rating), {}, class: 'form-select')
      = render partial: 'webui/patchinfo/form/issues',
        locals: { form: form, issues: @patchinfo.issues, project: @project, package: @package }
      = render partial: 'webui/patchinfo/form/required_actions',
        locals: { form: form, zypp_restart_needed: @zypp_restart_needed, relogin: @relogin, reboot: @reboot }
      = render partial: 'webui/patchinfo/form/binaries',
        locals: { form: form, binarylist: @binarylist, binaries: @patchinfo.binaries }
      = render partial: 'webui/patchinfo/form/block_release',
        locals: { form: form, patchinfo_block: @patchinfo.block }

      = form.submit('Save', class: 'btn btn-primary', data: { disable_with: 'Saving...' })

- content_for :ready_function do
  setupPatchinfo();
