adjust form builder

This commit is contained in:
Alex Turchyn
2023-11-21 23:08:59 +02:00
committed by Pete Matsyburka
parent e07b50c22d
commit b85c9cfdb7
6 changed files with 26 additions and 22 deletions
@@ -74,7 +74,7 @@
:stroke-width="1.6" :stroke-width="1.6"
/> />
<span class="py-1"> <span class="py-1">
Add Submitter Add {{ names[submitters.length] }}
</span> </span>
</a> </a>
</li> </li>
@@ -100,7 +100,7 @@
<label <label
v-else v-else
tabindex="0" tabindex="0"
class="cursor-pointer group/contenteditable-container rounded-md p-2 border border-base-300 w-full flex justify-between" class="group cursor-pointer group/contenteditable-container rounded-md p-2 border border-base-300 hover:border-content w-full flex justify-between"
> >
<div class="flex items-center space-x-2"> <div class="flex items-center space-x-2">
<span <span
@@ -117,7 +117,7 @@
@update:model-value="$emit('name-change', selectedSubmitter)" @update:model-value="$emit('name-change', selectedSubmitter)"
/> />
</div> </div>
<span class="flex items-center"> <span class="flex items-center transition-all duration-75 group-hover:border border-base-content/20 border-dashed w-6 h-6 flex justify-center items-center rounded">
<IconPlus <IconPlus
width="18" width="18"
height="18" height="18"
@@ -169,7 +169,7 @@
:stroke-width="1.6" :stroke-width="1.6"
/> />
<span class="py-1"> <span class="py-1">
Add Submitter Add {{ names[submitters.length] }}
</span> </span>
</a> </a>
</li> </li>
@@ -239,16 +239,16 @@ export default {
}, },
names () { names () {
return [ return [
'First Submitter', 'First Party',
'Second Submitter', 'Second Party',
'Third Submitter', 'Third Party',
'Fourth Submitter', 'Fourth Party',
'Fifth Submitter', 'Fifth Party',
'Sixth Submitter', 'Sixth Party',
'Seventh Submitter', 'Seventh Party',
'Eighth Submitter', 'Eighth Party',
'Ninth Submitter', 'Ninth Party',
'Tenth Submitter' 'Tenth Party'
] ]
}, },
selectedSubmitter () { selectedSubmitter () {
+7 -3
View File
@@ -72,14 +72,14 @@
<button <button
v-if="withPhone || type != 'phone'" v-if="withPhone || type != 'phone'"
draggable="true" draggable="true"
class="flex items-center justify-center border border-dashed border-base-300 w-full rounded relative" class="group flex items-center justify-center border border-dashed border-base-300 hover:border-base-content/20 w-full rounded relative"
:style="{ backgroundColor: backgroundColor }" :style="{ backgroundColor: backgroundColor }"
@dragstart="onDragstart({ type: type })" @dragstart="onDragstart({ type: type })"
@dragend="$emit('drag-end')" @dragend="$emit('drag-end')"
@click="addField(type)" @click="addField(type)"
> >
<div class="w-0 absolute left-0"> <div class="flex items-console group-hover:bg-base-200/50 transition-all cursor-grab h-full absolute left-0">
<IconDrag class="cursor-grab" /> <IconDrag class=" my-auto" />
</div> </div>
<div class="flex items-center flex-col px-2 py-2"> <div class="flex items-center flex-col px-2 py-2">
<component :is="icon" /> <component :is="icon" />
@@ -257,6 +257,10 @@ export default {
this.fields.push(field) this.fields.push(field)
if (['signature', 'initials', 'cells'].includes(type)) {
this.$emit('set-draw', { field })
}
this.save() this.save()
} }
} }
+1 -1
View File
@@ -33,7 +33,7 @@
# fk_rails_... (folder_id => template_folders.id) # fk_rails_... (folder_id => template_folders.id)
# #
class Template < ApplicationRecord class Template < ApplicationRecord
DEFAULT_SUBMITTER_NAME = 'First Submitter' DEFAULT_SUBMITTER_NAME = 'First Party'
belongs_to :author, class_name: 'User' belongs_to :author, class_name: 'User'
belongs_to :account belongs_to :account
+1 -1
View File
@@ -34,7 +34,7 @@
"submitters": [ "submitters": [
{ {
"name": "John Doe", "name": "John Doe",
"role": "<%= current_account.templates.last ? current_account.templates.last.submitters.first['name'] : 'First Submitter' %>", "role": "<%= current_account.templates.last ? current_account.templates.last.submitters.first['name'] : 'First Party' %>",
"email": "<%= current_user.email.sub('@', '+test@') %>", "email": "<%= current_user.email.sub('@', '+test@') %>",
"values": { "values": {
"Form Text Field Name": "Default Value" "Form Text Field Name": "Default Value"
@@ -2,8 +2,8 @@
<div class="form-control"> <div class="form-control">
<%= f.label :preserve_order, for: uuid = SecureRandom.uuid, class: 'flex items-center cursor-pointer' do %> <%= f.label :preserve_order, for: uuid = SecureRandom.uuid, class: 'flex items-center cursor-pointer' do %>
<%= f.check_box :preserve_order, id: uuid, class: 'base-checkbox', checked: template.submissions.last&.submitters_order.in?(['preserved', nil]) %> <%= f.check_box :preserve_order, id: uuid, class: 'base-checkbox', checked: template.submissions.last&.submitters_order.in?(['preserved', nil]) %>
<span class="label">Preserve submitters order</span> <span class="label">Preserve order</span>
<span class="tooltip" data-tip="When checked, notifications will be sent to the second submitter once the form is completed by the previous submitter. Uncheck this option to send notifications to all submitters simultaneously right away."> <span class="tooltip" data-tip="When checked, notifications will be sent to the second party once the form is completed by the previous party. Uncheck this option to send notifications to all parties simultaneously right away.">
<%= svg_icon('info_circle', class: 'w-4 h-4') %> <%= svg_icon('info_circle', class: 'w-4 h-4') %>
</span> </span>
<% end %> <% end %>
+1 -1
View File
@@ -24,7 +24,7 @@ FactoryBot.define do
template.schema = [{ attachment_uuid: attachment.uuid, name: 'sample-document' }] template.schema = [{ attachment_uuid: attachment.uuid, name: 'sample-document' }]
template.submitters = [ template.submitters = [
{ {
'name' => 'First Submitter', 'name' => 'First Party',
'uuid' => '513848eb-1096-4abc-a743-68596b5aaa4c' 'uuid' => '513848eb-1096-4abc-a743-68596b5aaa4c'
} }
] ]