Skip to content

Commit

Permalink
DocGen example updates to use Dynamic Tables (#158)
Browse files Browse the repository at this point in the history
* update doc gen example
  • Loading branch information
RomanBachaloSigmaSoftware authored Apr 15, 2024
1 parent 326b325 commit 49e1783
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ end

gem 'docusign_admin', '~> 1.3.0'
gem 'docusign_click', '~> 1.4.0'
gem 'docusign_esign', '~> 3.25.0'
gem 'docusign_esign', '~> 3.27.0.rc1'
gem 'docusign_maestro', '~> 1.0.0.rc1'
gem 'docusign_monitor', '~> 1.2.0'
gem 'docusign_rooms', '~> 1.3.0'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ GEM
json (~> 2.1, >= 2.1.0)
jwt (~> 2.2, >= 2.2.1)
typhoeus (~> 1.0, >= 1.0.1)
docusign_esign (3.25.0)
docusign_esign (3.27.0.rc1)
addressable (~> 2.7, >= 2.7.0)
json (~> 2.1, >= 2.1.0)
jwt (~> 2.2, >= 2.2.1)
Expand Down Expand Up @@ -349,7 +349,7 @@ DEPENDENCIES
coffee-rails (~> 5.0.0)
docusign_admin (~> 1.3.0)
docusign_click (~> 1.4.0)
docusign_esign (~> 3.25.0)
docusign_esign (~> 3.27.0.rc1)
docusign_maestro (~> 1.0.0.rc1)
docusign_monitor (~> 1.2.0)
docusign_rooms (~> 1.3.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ def create
manager_name: param_gsub(params['manager_name']),
job_title: param_gsub(params['job_title']),
salary: param_gsub(params['salary']),
rsus: param_gsub(params['rsus']),
start_date: param_gsub(params['start_date']),
doc_file: File.join('data', Rails.application.config.doc_offer_letter)
doc_file: File.join('data', Rails.application.config.offer_letter_dynamic_table)
}
args = {
account_id: session['ds_account_id'],
Expand Down
52 changes: 46 additions & 6 deletions app/services/e_sign/eg042_document_generation_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def recipient_tabs
anchorYOffset: '-22'
)
date_signed = DocuSign_eSign::DateSigned.new(
anchorString: 'Date',
anchorString: 'Date Signed',
anchorUnits: 'pixels',
anchorYOffset: '-22'
)
Expand Down Expand Up @@ -144,6 +144,8 @@ def make_envelope(template_id, args)

#ds-snippet-start:eSign42Step7
def form_fields(args, document_id_guid)
bonus_value = '20%'

candidate_name_field = DocuSign_eSign::DocGenFormField.new(
name: 'Candidate_Name',
value: args[:candidate_name]
Expand All @@ -156,16 +158,54 @@ def form_fields(args, document_id_guid)
name: 'Job_Title',
value: args[:job_title]
)
salary_field = DocuSign_eSign::DocGenFormField.new(
name: 'Salary',
value: args[:salary]
)
start_date_field = DocuSign_eSign::DocGenFormField.new(
name: 'Start_Date',
value: args[:start_date]
)

salary_row = DocuSign_eSign::DocGenFormFieldRowValue.new(
docGenFormFieldList: [
DocuSign_eSign::DocGenFormField.new(
name: 'Compensation_Component',
value: 'Salary'
),
DocuSign_eSign::DocGenFormField.new(
name: 'Details',
value: "$#{args[:salary]}"
)
]
)
bonus_row = DocuSign_eSign::DocGenFormFieldRowValue.new(
docGenFormFieldList: [
DocuSign_eSign::DocGenFormField.new(
name: 'Compensation_Component',
value: 'Bonus'
),
DocuSign_eSign::DocGenFormField.new(
name: 'Details',
value: bonus_value
)
]
)
rsus_row = DocuSign_eSign::DocGenFormFieldRowValue.new(
docGenFormFieldList: [
DocuSign_eSign::DocGenFormField.new(
name: 'Compensation_Component',
value: 'RSUs'
),
DocuSign_eSign::DocGenFormField.new(
name: 'Details',
value: args[:rsus]
)
]
)
compensation_package = DocuSign_eSign::DocGenFormField.new(
name: 'Compensation_Package',
type: 'TableRow',
rowValues: [salary_row, bonus_row, rsus_row]
)
doc_gen_form_fields_list = [
candidate_name_field, manager_name_field, salary_field, job_title_field, start_date_field
candidate_name_field, manager_name_field, job_title_field, start_date_field, compensation_package
]

doc_gen_form_fields = DocuSign_eSign::DocGenFormFields.new(
Expand Down
9 changes: 7 additions & 2 deletions app/views/e_sign/eeg042_document_generation/get.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<% job_title_index = 3 %>
<% salary_index = 4 %>
<% start_date_index = 5 %>
<% rsus_index = 6 %>

<form class="eg" action="" method="post" data-busy="form">
<% if @example["Forms"][form_index]["FormName"] %>
Expand Down Expand Up @@ -34,15 +35,19 @@
<label for="job_title"><%= @example['Forms'][form_index]['Inputs'][job_title_index]['InputName'] %></label>
<select class="form-control" id="job_title" name="job_title">
<option value="Software Engineer">Software Engineer</option>
<option value="Product Manager">Product Manager</option>
<option value="Sales Representative">Sales Representative</option>
<option value="Account Executive">Account Executive</option>
</select>
</div>
<div class="form-group">
<label for="salary"><%= @example['Forms'][form_index]['Inputs'][salary_index]['InputName'] %></label>
<input type="text" class="form-control" id="salary" placeholder="<%= @example['Forms'][form_index]['Inputs'][salary_index]['InputPlaceholder'] %>" name="salary"
required />
</div>
<div class="form-group">
<label for="rsus"><%= @example['Forms'][form_index]['Inputs'][rsus_index]['InputName'] %></label>
<input type="number" class="form-control" id="rsus" placeholder="<%= @example['Forms'][form_index]['Inputs'][rsus_index]['InputPlaceholder'] %>" name="rsus"
min="0" required />
</div>
<div class="form-group">
<label for="start_date"><%= @example['Forms'][form_index]['Inputs'][start_date_index]['InputName'] %></label>
<input type="date" class="form-control" id="start_date" placeholder="<%= @example['Forms'][form_index]['Inputs'][start_date_index]['InputPlaceholder'] %>" name="start_date"
Expand Down
2 changes: 1 addition & 1 deletion config/appsettings.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ default: &default
doc_docx: World_Wide_Corp_Battle_Plan_Trafalgar.docx
doc_pdf: World_Wide_Corp_lorem.pdf
doc_terms_pdf: Term_Of_Service.pdf
doc_offer_letter: Offer_Letter_Demo.docx
offer_letter_dynamic_table: Offer_Letter_Dynamic_Table.docx
web_form_template_file: World_Wide_Corp_Form.pdf
web_form_config_file: web-form-config.json
gateway_name: "stripe"
Expand Down
Binary file added data/Offer_Letter_Dynamic_Table.docx
Binary file not shown.

0 comments on commit 49e1783

Please sign in to comment.