diff --git a/app/controllers/api/submitters_controller.rb b/app/controllers/api/submitters_controller.rb index c2e6a07f..4d53d3cb 100644 --- a/app/controllers/api/submitters_controller.rb +++ b/app/controllers/api/submitters_controller.rb @@ -162,7 +162,7 @@ module Api submitters = submitters.where(submission_id: params[:submission_id]) if params[:submission_id].present? if params[:template_id].present? - submitters = submitters.joins(:submission).where(submission: { template_id: params[:template_id] }) + submitters = submitters.joins(:submission).where(submissions: { template_id: params[:template_id] }) end maybe_filder_by_completed_at(submitters, params) diff --git a/app/controllers/start_form_controller.rb b/app/controllers/start_form_controller.rb index 080b9807..c79535ec 100644 --- a/app/controllers/start_form_controller.rb +++ b/app/controllers/start_form_controller.rb @@ -43,9 +43,11 @@ class StartFormController < ApplicationController if @submitter.save if is_new_record - WebhookUrls.for_account_id(@submitter.account_id, 'submission.created').each do |webhook_url| - SendSubmissionCreatedWebhookRequestJob.perform_async('submission_id' => @submitter.submission_id, - 'webhook_url_id' => webhook_url.id) + enqueue_submission_create_webhooks(@submitter) + + if @submitter.submission.expire_at? + ProcessSubmissionExpiredJob.perform_at(@submitter.submission.expire_at, + 'submission_id' => @submitter.submission_id) end end @@ -64,6 +66,13 @@ class StartFormController < ApplicationController private + def enqueue_submission_create_webhooks(submitter) + WebhookUrls.for_account_id(submitter.account_id, 'submission.created').each do |webhook_url| + SendSubmissionCreatedWebhookRequestJob.perform_async('submission_id' => submitter.submission_id, + 'webhook_url_id' => webhook_url.id) + end + end + def find_or_initialize_submitter(template, submitter_params) Submitter.where(submission: template.submissions.where(expire_at: Time.current..) .or(template.submissions.where(expire_at: nil)).where(archived_at: nil)) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 47a88e05..9771fc4e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -16,7 +16,7 @@ class UsersController < ApplicationController @users.active.where.not(role: 'integration') end - @pagy, @users = pagy(@users.where(account: current_account).order(id: :desc)) + @pagy, @users = pagy(@users.preload(account: :account_accesses).where(account: current_account).order(id: :desc)) end def new; end diff --git a/app/javascript/elements/dashboard_dropzone.js b/app/javascript/elements/dashboard_dropzone.js index b99c00ff..60cd0b91 100644 --- a/app/javascript/elements/dashboard_dropzone.js +++ b/app/javascript/elements/dashboard_dropzone.js @@ -165,11 +165,27 @@ export default targetable(class extends HTMLElement { onDragover (e) { if (e.dataTransfer?.types?.includes('Files') || this.dataset.targets !== 'dashboard-dropzone.templateCards') { this.style.backgroundColor = '#F7F3F0' + + if (this.classList.contains('before:border-base-300')) { + this.classList.remove('before:border-base-300') + this.classList.add('before:border-base-content/30') + } else if (this.classList.contains('border-base-300')) { + this.classList.remove('border-base-300') + this.classList.add('border-base-content/30') + } } } onDragleave () { this.style.backgroundColor = null + + if (this.classList.contains('before:border-base-content/30')) { + this.classList.remove('before:border-base-content/30') + this.classList.add('before:border-base-300') + } else if (this.classList.contains('border-base-content/30')) { + this.classList.remove('border-base-content/30') + this.classList.add('border-base-300') + } } onWindowDragleave = (e) => { diff --git a/app/javascript/elements/file_dropzone.js b/app/javascript/elements/file_dropzone.js index 76411a50..12ef253d 100644 --- a/app/javascript/elements/file_dropzone.js +++ b/app/javascript/elements/file_dropzone.js @@ -5,19 +5,37 @@ export default actionable(targetable(class extends HTMLElement { static [target.static] = [ 'loading', 'icon', - 'input' + 'input', + 'area' ] connectedCallback () { - this.addEventListener('drop', this.onDrop) - this.addEventListener('dragover', (e) => e.preventDefault()) - + this.addEventListener('drop', this.onDrop) document.addEventListener('turbo:submit-end', this.toggleLoading) + this.area?.addEventListener('dragover', this.onDragover) + this.area?.addEventListener('dragleave', this.onDragleave) } disconnectedCallback () { + this.removeEventListener('drop', this.onDrop) document.removeEventListener('turbo:submit-end', this.toggleLoading) + this.area?.removeEventListener('dragover', this.onDragover) + this.area?.removeEventListener('dragleave', this.onDragleave) + } + + onDragover (e) { + if (e.dataTransfer?.types?.includes('Files')) { + this.style.backgroundColor = '#F7F3F0' + this.classList.remove('border-base-300', 'hover:bg-base-200/30') + this.classList.add('border-base-content/30') + } + } + + onDragleave () { + this.style.backgroundColor = null + this.classList.remove('border-base-content/30') + this.classList.add('border-base-300', 'hover:bg-base-200/30') } onDrop (e) { diff --git a/app/javascript/submission_form/area.vue b/app/javascript/submission_form/area.vue index d18aae5f..01819533 100644 --- a/app/javascript/submission_form/area.vue +++ b/app/javascript/submission_form/area.vue @@ -55,10 +55,12 @@ >
ID: {{ signature.uuid }} @@ -444,6 +447,9 @@ export default { } return style + }, + isNarrow () { + return this.area.h > 0 && (this.area.w / this.area.h) > 6 } }, watch: { diff --git a/app/javascript/submission_form/form.vue b/app/javascript/submission_form/form.vue index 2a9d8e97..c229ed11 100644 --- a/app/javascript/submission_form/form.vue +++ b/app/javascript/submission_form/form.vue @@ -93,7 +93,7 @@
@@ -1133,7 +1133,7 @@ export default { parent.style.overflow = 'hidden' scrollbox.classList.add('h-full', 'overflow-y-auto') - scrollbox.parentNode.classList.add('h-screen', 'overflow-y-auto') + scrollbox.parentNode.classList.add('h-screen', 'h-[100dvh]', 'overflow-y-auto') scrollbox.parentNode.style.maxHeight = '-webkit-fill-available' }) } diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue index 77e1bb96..514740eb 100644 --- a/app/javascript/template_builder/builder.vue +++ b/app/javascript/template_builder/builder.vue @@ -13,7 +13,6 @@ :template-id="template.id" :accept-file-types="acceptFileTypes" :with-replace-and-clone="withReplaceAndCloneUpload" - hover-class="bg-base-200/50" @add="[updateFromUpload($event), isDragFile = false]" @replace="[onDocumentsReplace($event), isDragFile = false]" @replace-and-clone="onDocumentsReplaceAndTemplateClone($event)" diff --git a/app/javascript/template_builder/dropzone.vue b/app/javascript/template_builder/dropzone.vue index ce97bcc1..9031f3d1 100644 --- a/app/javascript/template_builder/dropzone.vue +++ b/app/javascript/template_builder/dropzone.vue @@ -10,7 +10,7 @@ id="document_dropzone" class="w-full relative rounded-md border-2 border-base-content/10 border-dashed" :for="inputId" - :class="[{ 'opacity-50': isLoading, 'hover:bg-base-200/30': !hoverClass }, isDragEntering && hoverClass ? hoverClass : '']" + :class="{ 'opacity-50': isLoading, 'hover:bg-base-200/50': withHoverClass && !isDragEntering, 'bg-base-200/50 border-base-content/30': isDragEntering }" >
@@ -79,16 +79,16 @@ export default { type: [Number, String], required: true }, + withHoverClass: { + type: Boolean, + required: false, + default: true + }, icon: { type: String, required: false, default: 'IconCloudUpload' }, - hoverClass: { - type: String, - required: false, - default: null - }, cloneTemplateOnUpload: { type: Boolean, required: false, diff --git a/app/javascript/template_builder/hover_dropzone.vue b/app/javascript/template_builder/hover_dropzone.vue index 5c9ccf28..5b3ff397 100644 --- a/app/javascript/template_builder/hover_dropzone.vue +++ b/app/javascript/template_builder/hover_dropzone.vue @@ -6,12 +6,12 @@
{ testing }, dependent: :destroy, class_name: 'AccountLinkedAccount', inverse_of: :account diff --git a/app/models/account_access.rb b/app/models/account_access.rb new file mode 100644 index 00000000..162c3703 --- /dev/null +++ b/app/models/account_access.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +# == Schema Information +# +# Table name: account_accesses +# +# id :bigint not null, primary key +# created_at :datetime not null +# updated_at :datetime not null +# account_id :bigint not null +# user_id :bigint not null +# +# Indexes +# +# index_account_accesses_on_account_id_and_user_id (account_id,user_id) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (account_id => accounts.id) +# +class AccountAccess < ApplicationRecord + belongs_to :account + belongs_to :user +end diff --git a/app/views/devise/shared/_select_server.html.erb b/app/views/devise/shared/_select_server.html.erb index 2b98ec18..ae04786f 100644 --- a/app/views/devise/shared/_select_server.html.erb +++ b/app/views/devise/shared/_select_server.html.erb @@ -1,12 +1,52 @@ -
- + + +<%= render 'scripts/server_selector' %> diff --git a/app/views/icons/_corner_right_down.html.erb b/app/views/icons/_corner_right_down.html.erb new file mode 100644 index 00000000..4aa40662 --- /dev/null +++ b/app/views/icons/_corner_right_down.html.erb @@ -0,0 +1,3 @@ + + + diff --git a/app/views/icons/_usa_flag.html.erb b/app/views/icons/_usa_flag.html.erb new file mode 100644 index 00000000..3b45d6f6 --- /dev/null +++ b/app/views/icons/_usa_flag.html.erb @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/app/views/scripts/_server_selector.html.erb b/app/views/scripts/_server_selector.html.erb new file mode 100644 index 00000000..d8a365a6 --- /dev/null +++ b/app/views/scripts/_server_selector.html.erb @@ -0,0 +1,22 @@ + diff --git a/app/views/shared/_classes.html.erb b/app/views/shared/_classes.html.erb index 2c291713..7069b153 100644 --- a/app/views/shared/_classes.html.erb +++ b/app/views/shared/_classes.html.erb @@ -1 +1 @@ -<% 'stats stat stat-figure stat-title stat-value text-accent w-fit hover:bg-white dropdown-open' %> +<% 'stats stat stat-figure stat-title stat-value text-accent w-fit hover:bg-white dropdown-open border-base-content/30 before:border-base-content/30' %> diff --git a/app/views/submissions/_value.html.erb b/app/views/submissions/_value.html.erb index c9ab473d..852711fa 100644 --- a/app/views/submissions/_value.html.erb +++ b/app/views/submissions/_value.html.erb @@ -5,12 +5,13 @@ <% font_type = field.dig('preferences', 'font_type') %> width: <%= area['w'] * 100 %>%; height: <%= area['h'] * 100 %>%; left: <%= area['x'] * 100 %>%; top: <%= area['y'] * 100 %>%; <%= "font-size: clamp(4pt, 1.6vw, #{field['preferences']['font_size'].to_i * 1.23}pt); line-height: `clamp(6pt, 2.0vw, #{(field['preferences']['font_size'].to_i * 1.23) + 3}pt)`" if field.dig('preferences', 'font_size') %>"> <% if field['type'] == 'signature' %> -
-
+ <% is_narrow = area['h']&.positive? && (area['w'].to_f / area['h']) > 6 %> +
+
<% if local_assigns[:with_signature_id] && attachment = attachments_index[value] %> -
+
ID: <%= attachment.uuid %>
diff --git a/app/views/templates/_dropzone.html.erb b/app/views/templates/_dropzone.html.erb index 95128c1a..124efa83 100644 --- a/app/views/templates/_dropzone.html.erb +++ b/app/views/templates/_dropzone.html.erb @@ -2,8 +2,8 @@ -