<%= form_for '', url: templates_upload_path, id: form_id = SecureRandom.uuid, method: :post, class: 'inline', html: { enctype: 'multipart/form-data' } do %>
  <label for="upload_template" id="templates_upload_button" class="btn btn-ghost text-base">
    <button type="submit" class="hidden peer"></button>
    <span class="peer-disabled:hidden">
      <span class="flex items-center justify-center space-x-2">
        <%= svg_icon('upload', class: 'w-6 h-6 stroke-2') %>
        <span class="hidden md:block"><%= t('upload') %></span>
      </span>
    </span>
    <span class="peer-enabled:hidden">
      <span class="flex items-center justify-center space-x-2">
        <%= local_assigns[:icon_disabled] || svg_icon('loader', class: 'w-5 h-5 animate-spin') %>
        <span class="hidden md:block"><%= t('upload') %>...</span>
      </span>
    </span>
  </label>
  <input type="hidden" name="form_id" value="<%= form_id %>">
  <convert-upload>
    <input id="upload_template" name="files[]" class="hidden" type="file" accept="image/*, application/pdf, application/zip, application/json<%= ", #{Templates::CreateAttachments::DOCUMENT_EXTENSIONS.join(', ')}" if Docuseal.advanced_formats? %>" multiple>
  </convert-upload>
  <input hidden name="folder_name" value="<%= local_assigns[:folder_name] %>">
<% end %>
