initial commit

This commit is contained in:
Alex Turchyn
2023-05-21 17:59:36 +03:00
commit 97c462ead2
159 changed files with 10987 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
Submissions
Flow <%= @flow.name %>
Copy share link:
<input autocomplete="off" type="text" class="w-full" value="<%= start_flow_url(slug: @flow.slug) %>" disabled>
<a href="<%= new_flow_submission_path(@flow) %>" class="bg-green-600" data-turbo-frame="modal">Add Recepients</a>
<table>
<tr>
<th>
Email
</th>
<th>
Status
</th>
<th>
</th>
</tr>
<% @submissions.each do |submission| %>
<tr>
<td>
<%= submission.email %>
</td>
<td>
<% if submission.completed_at? %>
Completed
<% elsif submission.opened_at? %>
Opened
<% elsif submission.sent_at? %>
Sent
<% else %>
Awaiting
<% end %>
</td>
<td>
copy link<br>
<%= link_to 'View', submission_path(@flow) %>
<%= button_to 'Remove', submission_path(submission), method: :delete, data: { turbo_confirm: 'Are you sure?' } %>
</td>
</tr>
<% end %>
</table>
+19
View File
@@ -0,0 +1,19 @@
<%= render 'shared/turbo_modal' do %>
<%= form_for '', url: flow_submissions_path(@flow), data: { turbo_frame: :_top } do |f| %>
<div>
<%= f.label :emails %>
<%= f.text_area :emails, required: true %>
</div>
<div>
<%= f.check_box :send_email, { onchange: "message_field.classList.toggle('hidden', !event.currentTarget.checked)" } %>
<%= f.label :send_email %>
</div>
<div id="message_field" class="hidden">
Hi There,
<%= f.text_area :message, value: SubmissionMailer::DEFAULT_MESSAGE, required: true %>
Thanks,
<%= current_account.name %>
</div>
<%= f.button button_title %>
<% end %>
<% end %>
+21
View File
@@ -0,0 +1,21 @@
Flow: <%= @submission.flow.name %>
Sub: <%= @submission.slug %>
Copy share link:
<input autocomplete="off" type="text" class="w-full" value="<%= submit_flow_url(slug: @submission.slug) %>" disabled>
<% @submission.flow.fields.each do |field| %>
<div>
<%= field['name'] %>:
<% if ['image', 'signature'].include?(field['type']) %>
<% Array.wrap(@submission.values[field['uuid']]).each do |uuid| %>
<img src="<%= ActiveStorage::Attachment.find_by(uuid:).url %>">
<% end %>
<% elsif ['attachment'].include?(field['type']) %>
<% Array.wrap(@submission.values[field['uuid']]).each do |uuid| %>
<% attachment = ActiveStorage::Attachment.find_by(uuid:) %>
<a href="<%= attachment.url %>"><%= attachment.filename %></a>
<% end %>
<% else %>
<%= @submission.values[field['uuid']] %>
<% end %>
</div>
<% end %>