mirror of https://github.com/docusealco/docuseal
				
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							183 lines
						
					
					
						
							11 KiB
						
					
					
				
			
		
		
	
	
							183 lines
						
					
					
						
							11 KiB
						
					
					
				| <div class="flex flex-col items-start md:flex-row space-y-2 md:space-y-0 md:justify-between md:items-center mb-8">
 | |
|   <h1 class="text-4xl font-semibold mr-4" style="overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;">
 | |
|     <%= @template.name %>
 | |
|   </h1>
 | |
|   <div class="flex md:justify-between space-x-2 flex-none">
 | |
|     <%= button_to button_title(title: 'Remove', disabled_with: 'Removing', icon: svg_icon('trash', class: 'w-6 h-6')), template_path(@template), class: 'btn btn-outline btn-sm', method: :delete, data: { turbo_confirm: 'Are you sure?' } %>
 | |
|     <%= link_to new_template_path(base_template_id: @template.id), class: 'btn btn-outline btn-sm', data: { turbo_frame: :modal } do %>
 | |
|       <%= svg_icon('copy', class: 'w-6 h-6') %>
 | |
|       <span>Clone</span>
 | |
|     <% end %>
 | |
|     <%= link_to edit_template_path(@template), class: 'btn btn-outline btn-sm' do %>
 | |
|       <span class="flex items-center justify-center space-x-2">
 | |
|         <%= svg_icon('pencil', class: 'w-6 h-6') %>
 | |
|         <span>Edit</span>
 | |
|       </span>
 | |
|     <% end %>
 | |
|   </div>
 | |
| </div>
 | |
| <% if !@pagy.count.zero? || @template.submitters.to_a.size == 1 %>
 | |
|   <div class="flex justify-between mb-6 md:items-end flex-col md:flex-row">
 | |
|     <p class="text-3xl font-bold">Submissions</p>
 | |
|     <div class="flex space-x-2 mt-3 md:mt-0">
 | |
|       <%= link_to new_template_submissions_export_path(@template), class: 'order-3 md:order-1 btn btn-ghost text-base', data: { turbo_frame: 'modal' } do %>
 | |
|         <%= svg_icon('download', class: 'w-6 h-6 stroke-2') %>
 | |
|         <span>Export</span>
 | |
|       <% end %>
 | |
|       <% if @template.submitters.to_a.size == 1 %>
 | |
|         <span class="order-1">
 | |
|           <%= render 'shared/clipboard_copy', text: start_form_url(slug: @template.slug), class: 'base-button', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy Share Link', copied_title: 'Copied to Clipboard', copy_title_md: 'Copy', copied_title_md: 'Copied' %>
 | |
|         </span>
 | |
|       <% end %>
 | |
|       <% unless @pagy.count.zero? %>
 | |
|         <%= link_to new_template_submission_path(@template), class: 'order-1 btn btn-primary text-base', data: { turbo_frame: 'modal' } do %>
 | |
|           <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %>
 | |
|           <span>Add <span class="hidden md:inline">Recipients</span></span>
 | |
|         <% end %>
 | |
|       <% end %>
 | |
|     </div>
 | |
|   </div>
 | |
| <% end %>
 | |
| <% status_badges = { 'awaiting' => 'badge-info', 'sent' => 'badge-info', 'completed' => 'badge-success', 'opened' => 'badge-warning' } %>
 | |
| <% if @submissions.present? %>
 | |
|   <div class="space-y-4">
 | |
|     <% @submissions.each do |submission| %>
 | |
|       <a href="<%= submission_path(submission) %>" class="bg-base-200 w-full flex flex-col md:flex-row space-y-4 md:space-y-0 md:justify-between rounded-2xl px-6 py-5 md:items-center">
 | |
|         <% submitters = (submission.template_submitters || submission.template.submitters).filter_map { |item| submission.submitters.find { |e| e.uuid == item['uuid'] } } %>
 | |
|         <% is_submission_completed = submitters.all?(&:completed_at?) %>
 | |
|         <% if submitters.size == 1 %>
 | |
|           <div>
 | |
|             <% submitter = submitters.first %>
 | |
|             <div class="flex items-center space-x-4">
 | |
|               <span class="flex items-center space-x-3">
 | |
|                 <div class="tooltip flex" data-tip="<%= l(submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
 | |
|                   <span class="badge <%= status_badges[submitter.status] %> md:w-32 badge-lg bg-opacity-50 uppercase text-sm font-semibold">
 | |
|                     <%= submitter.status %>
 | |
|                   </span>
 | |
|                 </div>
 | |
|                 <span class="text-lg break-all">
 | |
|                   <%= submitter.email %>
 | |
|                 </span>
 | |
|               </span>
 | |
|             </div>
 | |
|           </div>
 | |
|           <div class="flex space-x-2 items-center">
 | |
|             <% if submitter.completed_at? %>
 | |
|               <form onsubmit="event.preventDefault()">
 | |
|                 <button onclick="event.stopPropagation()">
 | |
|                   <download-button data-src="<%= submitter_download_index_path(submitter.slug) %>" class="btn btn-sm btn-neutral text-white md:w-36">
 | |
|                     <span class="flex items-center justify-center space-x-2" data-target="download-button.defaultButton">
 | |
|                       <%= svg_icon('download', class: 'w-5 h-5 stroke-2') %>
 | |
|                       <span class="inline">Download</span>
 | |
|                     </span>
 | |
|                     <span class="flex items-center justify-center space-x-2 hidden" data-target="download-button.loadingButton">
 | |
|                       <%= svg_icon('loader', class: 'w-5 h-5 animate-spin') %>
 | |
|                       <span class="inline">Downloa...</span>
 | |
|                     </span>
 | |
|                   </download-button>
 | |
|                 </button>
 | |
|               </form>
 | |
|             <% else %>
 | |
|               <%= render 'shared/clipboard_copy', text: submit_form_url(slug: submitter.slug), class: 'btn btn-sm btn-neutral text-white md:w-36 flex', icon_class: 'w-6 h-6 text-white', copy_title: 'Copy Link' %>
 | |
|             <% end %>
 | |
|             <span class="btn btn-outline btn-sm w-20 md:w-24">View</span>
 | |
|             <%= button_to button_title(title: nil, disabled_with: 'Remov', icon: svg_icon('trash', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm', title: 'Delete', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %>
 | |
|           </div>
 | |
|         <% else %>
 | |
|           <div class="space-y-1 w-full md:mr-2">
 | |
|             <div class="flex items-center space-x-3">
 | |
|               <% if is_submission_completed %>
 | |
|                 <% latest_submitter = submitters.select(&:completed_at?).max_by(&:completed_at) %>
 | |
|                 <div class="tooltip flex" data-tip="<%= l(latest_submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
 | |
|                   <span class="badge <%= status_badges[latest_submitter.status] %> md:w-32 bg-opacity-50 badge-lg uppercase text-sm font-semibold">
 | |
|                     <%= latest_submitter.status %>
 | |
|                   </span>
 | |
|                 </div>
 | |
|               <% end %>
 | |
|               <div class="w-full">
 | |
|                 <% submitters.each_with_index do |submitter, index| %>
 | |
|                   <div class="flex justify-between items-center space-x-3">
 | |
|                     <span class="flex items-center space-x-3">
 | |
|                       <% unless is_submission_completed %>
 | |
|                         <div class="tooltip flex" data-tip="<%= l(submitter.status_event_at.in_time_zone(current_account.timezone), format: :short, locale: current_account.locale) %>">
 | |
|                           <span class="badge md:w-24 <%= status_badges[submitter.status] %> bg-opacity-50 uppercase text-xs font-semibold">
 | |
|                             <%= submitter.status %>
 | |
|                           </span>
 | |
|                         </div>
 | |
|                       <% end %>
 | |
|                       <span class="text-lg break-all">
 | |
|                         <%= submitter.email %>
 | |
|                       </span>
 | |
|                     </span>
 | |
|                     <% if submitter.completed_at? && !is_submission_completed %>
 | |
|                       <form onsubmit="event.preventDefault()">
 | |
|                         <button onclick="event.stopPropagation()">
 | |
|                           <download-button data-src="<%= submitter_download_index_path(submitter.slug) %>" class="btn btn-xs btn-neutral text-white md:w-36">
 | |
|                             <span class="flex items-center justify-center space-x-2" data-target="download-button.defaultButton">
 | |
|                               <%= svg_icon('download', class: 'w-4 h-4 stroke-2') %>
 | |
|                               <span class="hidden md:inline">Download</span>
 | |
|                             </span>
 | |
|                             <span class="flex items-center justify-center space-x-2 hidden" data-target="download-button.loadingButton">
 | |
|                               <%= svg_icon('loader', class: 'w-4 h-4 animate-spin') %>
 | |
|                               <span class="hidden md:inline">Downloa...</span>
 | |
|                             </span>
 | |
|                           </download-button>
 | |
|                         </button>
 | |
|                       </form>
 | |
|                     <% elsif !is_submission_completed %>
 | |
|                       <div class="flex items-center space-x-3">
 | |
|                         <%= render 'shared/clipboard_copy', text: submit_form_url(slug: submitter.slug), class: 'btn btn-xs text-xs btn-neutral text-white md:w-36 flex', icon_class: 'w-4 h-4 text-white', copy_title: 'Copy Link' %>
 | |
|                       </div>
 | |
|                     <% end %>
 | |
|                   </div>
 | |
|                 <% end %>
 | |
|               </div>
 | |
|             </div>
 | |
|           </div>
 | |
|           <div class="flex space-x-2 items-center">
 | |
|             <% if is_submission_completed %>
 | |
|               <% latest_submitter = submitters.select(&:completed_at?).max_by(&:completed_at) %>
 | |
|               <form onsubmit="event.preventDefault()">
 | |
|                 <button onclick="event.stopPropagation()">
 | |
|                   <download-button data-src="<%= submitter_download_index_path(latest_submitter.slug) %>" class="btn btn-sm btn-neutral text-white md:w-36">
 | |
|                     <span class="flex items-center justify-center space-x-2" data-target="download-button.defaultButton">
 | |
|                       <%= svg_icon('download', class: 'w-5 h-5 stroke-2') %>
 | |
|                       <span class="inline">Download</span>
 | |
|                     </span>
 | |
|                     <span class="flex items-center justify-center space-x-2 hidden" data-target="download-button.loadingButton">
 | |
|                       <%= svg_icon('loader', class: 'w-5 h-5 animate-spin') %>
 | |
|                       <span class="inline">Downloa...</span>
 | |
|                     </span>
 | |
|                   </download-button>
 | |
|                 </button>
 | |
|               </form>
 | |
|             <% end %>
 | |
|             <span class="btn btn-outline btn-sm w-20 md:w-24">View</span>
 | |
|             <%= button_to button_title(title: nil, disabled_with: 'Remov', icon: svg_icon('trash', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm', title: 'Delete', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %>
 | |
|           </div>
 | |
|         <% end %>
 | |
|       </a>
 | |
|     <% end %>
 | |
|   </div>
 | |
|   <%= render 'shared/pagination', pagy: @pagy, items_name: 'submissions' %>
 | |
| <% else %>
 | |
|   <div class="card bg-base-200">
 | |
|     <div class="card-body text-center py-16">
 | |
|       <div class="max-w-lg mx-auto">
 | |
|         <p class="text-3xl font-bold text-base-content mb-4">There are no Submissions</p>
 | |
|         <p class="text-gray-600">Send an invitation to fill and complete the form</p>
 | |
|         <div class="space-x-2">
 | |
|           <%= link_to new_template_submission_path(@template), class: 'base-button mt-6', data: { turbo_frame: 'modal' } do %>
 | |
|             <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %>
 | |
|             <span class="mr-1">Add Recipients</span>
 | |
|           <% end %>
 | |
|           <%= link_to start_form_url(slug: @template.slug), class: 'white-button mt-6', target: '_blank', rel: 'noopener' do %>
 | |
|             <%= svg_icon('writing', class: 'w-6 h-6') %>
 | |
|             <span class="mr-1">Submit it Yourself</span>
 | |
|           <% end %>
 | |
|         </div>
 | |
|       </div>
 | |
|     </div>
 | |
|   </div>
 | |
| <% end %>
 |