Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added blank page #150

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
9e754cf
Adding a redacting box to hide the information on the document for in…
iozeey Sep 19, 2023
dc528b1
create image variant with permanent redact fields for submitter
iozeey Oct 5, 2023
614e3bc
after_save callback method for secured_image generation lib function
iozeey Oct 6, 2023
9c35677
show redacted image to the submitter
iozeey Oct 6, 2023
43840ec
adding redacting box on submitter pdf
iozeey Oct 9, 2023
b9ecb8e
Adding a redacting box to hide the information on the document for in…
iozeey Sep 19, 2023
1292197
create image variant with permanent redact fields for submitter
iozeey Oct 5, 2023
277758e
after_save callback method for secured_image generation lib function
iozeey Oct 6, 2023
9e51104
show redacted image to the submitter
iozeey Oct 6, 2023
bd7f12d
adding redacting box on submitter pdf
iozeey Oct 9, 2023
7f624de
Merge remote-tracking branch master into redacting
iozeey Nov 7, 2023
3801c73
merge
iozeey Nov 7, 2023
d7e653b
loading button
iozeey Nov 13, 2023
3ef2056
show all pages in preview portion
iozeey Nov 15, 2023
6c38173
Implement PDF loader
iozeey Nov 15, 2023
0c8ffa0
delete image and add blank page basics
iozeey Nov 16, 2023
318e4d7
scroll on preview image
iozeey Nov 16, 2023
efefe0b
delete page from pdf
iozeey Nov 17, 2023
4f14aed
blank page in preview document
iozeey Nov 18, 2023
18b14a9
side preview image correction
iozeey Nov 20, 2023
9cad047
updating delete and add blank image/page from backend for pdf too
iozeey Nov 21, 2023
7ddb8df
updating DocumentPreview component rendering
iozeey Nov 22, 2023
5f79012
component rendering with latest data without reloading
iozeey Nov 22, 2023
386288d
Adding loader on processing of add and remove page button
iozeey Nov 23, 2023
8d35f38
updating fields after deleting an image
iozeey Nov 23, 2023
33caf94
adjusting edit page loader
iozeey Nov 23, 2023
63a6d57
Merge branch 'master' into Added-blank-page
iozeey Nov 23, 2023
e67daa4
fields frontend update
iozeey Nov 24, 2023
15fe135
stabilizing redact required behavior
iozeey Nov 28, 2023
d809bf6
adding first self editable text-field for prefills portion
iozeey Dec 1, 2023
5e53276
fixing submit my_text prefill error.
iozeey Dec 4, 2023
1bfb35f
resolving redacting for submission view issue,
iozeey Dec 6, 2023
b2c051d
prefill my signature
iozeey Dec 6, 2023
e0fe5ac
creating a complete new my_signature and my_initials fields for both …
iozeey Dec 7, 2023
326d9ed
fix edit error
iozeey Dec 7, 2023
b20aa05
rename prefills and remove image src
iozeey Dec 7, 2023
1a6fefa
resolving errors of my signature and initials.
iozeey Dec 8, 2023
2399e73
Add prefill border and remove redact from condition
iozeey Dec 8, 2023
9f7bdc0
fixing my signature and initials drag issues
iozeey Dec 8, 2023
ae570b3
creating a date prefill fields for both template editor and form subm…
iozeey Dec 12, 2023
fece082
Show prefill date in pdf and view
iozeey Dec 13, 2023
1b26220
Adding a default me(fill out now) submitter field to save the fields …
iozeey Dec 14, 2023
135b020
solving page duplication error on deleting page
iozeey Dec 14, 2023
8956467
adding checkbox for me (fill now)
iozeey Dec 14, 2023
e50ef7f
show me fill now fields colors
iozeey Dec 14, 2023
f246dea
fixed no submitter for submission issue
iozeey Dec 14, 2023
c7dc594
resolving draw field issue for Me submitter
iozeey Dec 14, 2023
17a2500
fix me submitter select capability from recipient fields
iozeey Dec 14, 2023
09e892c
fixing my_date form submission view error
iozeey Dec 14, 2023
f6e8609
reset values on deleting me fields
iozeey Dec 15, 2023
cf628a8
fix reset values on deleting me fields
iozeey Dec 15, 2023
5c6d27b
fix reset values
iozeey Dec 15, 2023
e6d8b8b
fix reset values
iozeey Dec 15, 2023
a6492cf
fix me saved values issue on component rerender
iozeey Dec 18, 2023
6f96c51
removing me fields from field type dropdown
iozeey Dec 18, 2023
97dc227
field type selection filters according me and other submitters in sel…
iozeey Dec 19, 2023
ef0a008
merge master into Added-blank-page
iozeey Dec 21, 2023
33a322d
fixed field area dropdown menu
iozeey Dec 21, 2023
b65bf49
add document remove button
iozeey Dec 21, 2023
6d27609
code improvements
iozeey Dec 21, 2023
3a997f4
rename delete document button
iozeey Dec 26, 2023
e316772
adding field type dropdown for 'Me' submitter.
iozeey Dec 28, 2023
0f1dc7b
Adjust pdf blank page width according to existing page width
iozeey Jan 3, 2024
e57a8d2
resolving no value issue.
iozeey Jan 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions app/controllers/api/attachments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ class AttachmentsController < ApiBaseController
skip_authorization_check

def create
submitter = Submitter.find_by!(slug: params[:submitter_slug])

attachment = Submitters.create_attachment!(submitter, params)
record = if params[:template_slug].present?
Template.find_by!(slug: params[:template_slug])
else
Submitter.find_by!(slug: params[:submitter_slug])
end
attachment = Submitters.create_attachment!(record, params)

render json: attachment.as_json(only: %i[uuid], methods: %i[url filename content_type])
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/templates_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def serialize_params

def template_params
params.require(:template).permit(
:name,
:name, values: {},
schema: [%i[attachment_uuid name]],
submitters: [%i[name uuid]],
fields: [[:uuid, :submitter_uuid, :name, :type, :required, :readonly, :default_value,
Expand Down
57 changes: 57 additions & 0 deletions app/controllers/api/templates_documents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,62 @@ def create
)
}
end

def del_image
template = Template.find(params[:template_id])
document = template.documents.find(params[:document_id])
img_attachment_id = params[:attachment_id]
page_number = document.preview_images.find_index { |pic| pic.id == img_attachment_id }
if page_number
Templates::ProcessDocument.delete_picture(template, document, img_attachment_id, page_number)
template.fields.each do |field|
field['areas'] = (field['areas'] || []).reject do |area|
area['attachment_uuid'] == document[:uuid] && area['page'] == page_number
end
end
template.fields = (template.fields || []).reject do |field|
field['areas'].empty?
end
template.save
updated_images = updated_preview_images(document)
new_metadata = document.metadata
render json: { success: true, message: 'image deleted successfully', updated_preview_images: updated_images, updated_metadata: new_metadata }
else
page_number = "No image found for deletion"
render json: { success: false, message: "Error: #{page_number}" }, status: :unprocessable_entity
end
end

def add_new_image
template = Template.find(params[:template_id])
raw_document = params[:document]
document = template.documents.find_by(id: raw_document[:id])
begin
Templates::ProcessDocument.upload_new_blank_image(template, document)
updated_images = updated_preview_images(document)
new_metadata = document.metadata
render json: { success: true, message: 'New blank image added successfully', updated_preview_images: updated_images, updated_metadata: new_metadata }
rescue StandardError => e
render json: { success: false, message: "Error adding new blank image: #{e.message}" }, status: :unprocessable_entity
end
end

def updated_preview_images(document)
updated_images = document.preview_images.map do |image|
{
"id": image.id,
"name": image.name,
"uuid": image.uuid,
"record_type": image.record_type,
"record_id": image.record_id,
"blob_id": image.blob_id,
"filename": image.filename.as_json,
"metadata": image.metadata,
"url": image.url,
"created_at": image.created_at
}
end
end

end
end
2 changes: 1 addition & 1 deletion app/controllers/start_form_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class StartFormController < ApplicationController
before_action :load_template

def show
@submitter = @template.submissions.new.submitters.new(uuid: @template.submitters.first['uuid'])
@submitter = @template.submitters.second.nil? ? @template.submissions.new.submitters.new(uuid: @template.submitters.first['uuid']) : @template.submissions.new.submitters.new(uuid: @template.submitters.second['uuid'])
end

def update
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/submissions_preview_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def show
if total_pages < PRELOAD_ALL_PAGES_AMOUNT
ActiveRecord::Associations::Preloader.new(
records: @submission.template_schema_documents,
associations: [:blob, { preview_images_attachments: :blob }]
associations: [:blob, { preview_secured_images_attachments: :blob }]
).call
end

Expand Down
1 change: 1 addition & 0 deletions app/javascript/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ window.customElements.define('template-builder', class extends HTMLElement {

this.app = createApp(TemplateBuilder, {
template: reactive(JSON.parse(this.dataset.template)),
templateAttachments: reactive(JSON.parse(this.dataset.templateAttachmentsIndex)),
backgroundColor: '#faf7f5',
withPhone: this.dataset.withPhone === 'true',
withLogo: this.dataset.withLogo !== 'false',
Expand Down
51 changes: 48 additions & 3 deletions app/javascript/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ button[disabled] .enabled {
@apply select base-input w-full font-normal;
}

.bg-redact {
background: black;
}

.tooltip-bottom-end:before {
transform: translateX(-95%);
top: var(--tooltip-offset);
Expand Down Expand Up @@ -105,16 +109,16 @@ button[disabled] .enabled {
font: inherit;
}

.autocomplete > div {
.autocomplete>div {
@apply px-2 py-1 font-normal text-sm;
}

.autocomplete .group {
background: #eee;
}

.autocomplete > div:hover:not(.group),
.autocomplete > div.selected {
.autocomplete>div:hover:not(.group),
.autocomplete>div.selected {
@apply bg-base-300;
cursor: pointer;
}
Expand All @@ -125,3 +129,44 @@ button[disabled] .enabled {
outline-offset: 3px;
outline-color: hsl(var(--bc) / 0.2);
}

.my-display {
display: none;
}

#loader {
background: rgba(0, 7, 14, 0.7);
text-align: center;
position: absolute;
top: 0em;
left: 0em;
padding: 20% 0px;
height: 100vh;
width: 100vw;
text-align: -webkit-center;
}

.loader-animation {
width: 50px;
height: 50px;
border: 4px solid #fff;
border-top: 4px solid transparent;
border-radius: 50%;
animation: spin 1s linear infinite;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

@keyframes spin {
0% {
transform: rotate(0deg);
}

100% {
transform: rotate(360deg);
}
}

.text-load {
color: #fff;
font-size: large;
}
3 changes: 3 additions & 0 deletions app/javascript/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ window.customElements.define('submission-form', class extends HTMLElement {

this.app = createApp(Form, {
submitter: JSON.parse(this.dataset.submitter),
templateValues: JSON.parse(this.dataset.templateValues),
templateAttachments: reactive(JSON.parse(this.dataset.templateAttachmentsIndex)),
authenticityToken: this.dataset.authenticityToken,
canSendEmail: this.dataset.canSendEmail === 'true',
isDirectUpload: this.dataset.isDirectUpload === 'true',
goToLast: this.dataset.goToLast === 'true',
Expand Down
Loading