diff --git a/app/javascript/application.scss b/app/javascript/application.scss index 91aca432..4c705821 100644 --- a/app/javascript/application.scss +++ b/app/javascript/application.scss @@ -131,6 +131,8 @@ label.primary-button { :root { --tooltip-color: black; + --employee-color: #FFD687; + --manager-color: #D6E4FD; } .tooltip-bottom-end:before { @@ -205,3 +207,28 @@ label.primary-button { outline-offset: 3px; outline-color: hsl(var(--bc) / 0.2); } + +/* Custom party colors */ +.bg-employee-color { + background-color: var(--employee-color); +} + +.bg-manager-color { + background-color: var(--manager-color); +} + +.bg-employee-bg-color { + background-color: var(--employee-color); +} + +.bg-manager-bg-color { + background-color: var(--manager-color); +} + +.border-employee-color { + border-color: var(--employee-color); +} + +.border-manager-color { + border-color: var(--manager-color); +} diff --git a/app/javascript/template_builder/area.vue b/app/javascript/template_builder/area.vue index e0a5937e..df631ef0 100644 --- a/app/javascript/template_builder/area.vue +++ b/app/javascript/template_builder/area.vue @@ -447,8 +447,8 @@ export default { }, borderColors () { return [ - 'border-red-500/80', - 'border-sky-500/80', + 'border-employee-color', + 'border-manager-color', 'border-emerald-500/80', 'border-yellow-300/80', 'border-purple-600/80', @@ -461,8 +461,8 @@ export default { }, bgColors () { return [ - 'bg-red-100', - 'bg-sky-100', + 'bg-employee-bg-color', + 'bg-manager-bg-color', 'bg-emerald-100', 'bg-yellow-100', 'bg-purple-100', diff --git a/app/javascript/template_builder/field_submitter.vue b/app/javascript/template_builder/field_submitter.vue index a3151288..f344e597 100644 --- a/app/javascript/template_builder/field_submitter.vue +++ b/app/javascript/template_builder/field_submitter.vue @@ -287,8 +287,8 @@ export default { computed: { colors () { return [ - 'bg-red-500', - 'bg-sky-500', + 'bg-employee-color', + 'bg-manager-color', 'bg-emerald-500', 'bg-yellow-300', 'bg-purple-600', diff --git a/app/javascript/template_builder/i18n.js b/app/javascript/template_builder/i18n.js index 216657e0..16674fab 100644 --- a/app/javascript/template_builder/i18n.js +++ b/app/javascript/template_builder/i18n.js @@ -77,8 +77,8 @@ const en = { add_option: 'Add option', option: 'Option', condition: 'Condition', - first_party: 'First Party', - second_party: 'Second Party', + first_party: 'Employee', + second_party: 'Manager', third_party: 'Third Party', fourth_party: 'Fourth Party', fifth_party: 'Fifth Party', diff --git a/app/models/template.rb b/app/models/template.rb index a2d7fd19..315c580c 100644 --- a/app/models/template.rb +++ b/app/models/template.rb @@ -39,7 +39,7 @@ # fk_rails_... (folder_id => template_folders.id) # class Template < ApplicationRecord - DEFAULT_SUBMITTER_NAME = 'First Party' + DEFAULT_SUBMITTER_NAME = 'Employee' belongs_to :author, class_name: 'User' belongs_to :account diff --git a/app/views/api_settings/index.html.erb b/app/views/api_settings/index.html.erb index 7defd3c2..326b7a07 100644 --- a/app/views/api_settings/index.html.erb +++ b/app/views/api_settings/index.html.erb @@ -41,7 +41,7 @@ "submitters": [ { "name": "John Doe", - "role": "<%= current_account.templates.last ? current_account.templates.last.submitters.first['name'] : 'First Party' %>", + "role": "<%= current_account.templates.last ? current_account.templates.last.submitters.first['name'] : 'Employee' %>", "email": "<%= current_user.email.sub('@', '+test@') %>", "values": { "Form Text Field Name": "Default Value" diff --git a/config/locales/i18n.yml b/config/locales/i18n.yml index 7b5853b4..bbdfdd3e 100644 --- a/config/locales/i18n.yml +++ b/config/locales/i18n.yml @@ -43,7 +43,7 @@ en: &en invalid_code: Invalid code unarchive: Unarchive signed: Signed - first_party: 'First Party' + first_party: 'Employee' remove_filter: Remove filter add: Add adding: Adding diff --git a/spec/factories/templates.rb b/spec/factories/templates.rb index eb0ea8ba..428500c7 100644 --- a/spec/factories/templates.rb +++ b/spec/factories/templates.rb @@ -18,11 +18,12 @@ FactoryBot.define do end after(:create) do |template, ev| - number_words = %w[first second third fourth fifth sixth seventh eighth ninth tenth] + party_names = ['Employee', 'Manager', 'Third Party', 'Fourth Party', 'Fifth Party', 'Sixth Party', + 'Seventh Party', 'Eighth Party', 'Ninth Party', 'Tenth Party'] template.submitters = Array.new(ev.submitter_count) do |i| { - 'name' => "#{number_words[i]&.capitalize} Party", + 'name' => party_names[i], 'uuid' => SecureRandom.uuid } end diff --git a/spec/integration/prefill_integration_spec.rb b/spec/integration/prefill_integration_spec.rb index 6ab95172..801396f8 100644 --- a/spec/integration/prefill_integration_spec.rb +++ b/spec/integration/prefill_integration_spec.rb @@ -45,7 +45,7 @@ RSpec.describe 'ATS Prefill Integration', type: :request do author: user, folder: template_folder, fields: template_fields, - submitters: [{ 'name' => 'First Party', 'uuid' => 'submitter-uuid-1' }]) + submitters: [{ 'name' => 'Employee', 'uuid' => 'submitter-uuid-1' }]) end let(:submission) do @@ -54,7 +54,7 @@ RSpec.describe 'ATS Prefill Integration', type: :request do account: account, created_by_user: user, template_fields: template_fields, - template_submitters: [{ 'name' => 'First Party', 'uuid' => 'submitter-uuid-1' }]) + template_submitters: [{ 'name' => 'Employee', 'uuid' => 'submitter-uuid-1' }]) end let(:submitter) do diff --git a/spec/requests/submissions_spec.rb b/spec/requests/submissions_spec.rb index 7a362ef5..d4e7ba6b 100644 --- a/spec/requests/submissions_spec.rb +++ b/spec/requests/submissions_spec.rb @@ -77,7 +77,7 @@ describe 'Submission API' do post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: { template_id: templates[0].id, send_email: true, - submitters: [{ role: 'First Party', email: 'john.doe@example.com' }] + submitters: [{ role: 'Employee', email: 'john.doe@example.com' }] }.to_json expect(response).to have_http_status(:ok) @@ -91,7 +91,7 @@ describe 'Submission API' do post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: { template_id: templates[0].id, send_email: true, - submitters: [{ role: 'First Party', email: 'john.doe@example.com' }], + submitters: [{ role: 'Employee', email: 'john.doe@example.com' }], message: {} }.to_json @@ -105,7 +105,7 @@ describe 'Submission API' do it 'creates a submission when the submitter is marked as completed' do post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: { template_id: templates[0].id, - submitters: [{ role: 'First Party', email: 'john.doe@example.com', completed: true }] + submitters: [{ role: 'Employee', email: 'john.doe@example.com', completed: true }] }.to_json expect(response).to have_http_status(:ok) @@ -122,7 +122,7 @@ describe 'Submission API' do template_id: multiple_submitters_template.id, send_email: true, submitters: [ - { role: 'First Party', email: 'john.doe@example.com' }, + { role: 'Employee', email: 'john.doe@example.com' }, { email: 'jane.doe@example.com' }, { email: 'mike.doe@example.com' } ] @@ -134,9 +134,9 @@ describe 'Submission API' do expect(response.parsed_body).to eq(JSON.parse(create_submission_body(submission).to_json)) expect(response.parsed_body).to eq(JSON.parse(create_submission_body(submission).to_json)) - expect(response.parsed_body[0]['role']).to eq('First Party') + expect(response.parsed_body[0]['role']).to eq('Employee') expect(response.parsed_body[0]['email']).to eq('john.doe@example.com') - expect(response.parsed_body[1]['role']).to eq('Second Party') + expect(response.parsed_body[1]['role']).to eq('Manager') expect(response.parsed_body[1]['email']).to eq('jane.doe@example.com') expect(response.parsed_body[2]['role']).to eq('Third Party') expect(response.parsed_body[2]['email']).to eq('mike.doe@example.com') @@ -147,7 +147,7 @@ describe 'Submission API' do template_id: templates[0].id, send_email: true, submitters: [ - { role: 'First Party', email: 'john@example' } + { role: 'Employee', email: 'john@example' } ] }.to_json @@ -162,7 +162,7 @@ describe 'Submission API' do post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: { template_id: templates[0].id, send_email: true, - submitters: [{ role: 'First Party', email: 'john.doe@example.com' }] + submitters: [{ role: 'Employee', email: 'john.doe@example.com' }] }.to_json expect(response).to have_http_status(:unprocessable_entity) @@ -174,8 +174,8 @@ describe 'Submission API' do template_id: multiple_submitters_template.id, send_email: true, submitters: [ - { role: 'First Party', email: 'john.doe@example.com' }, - { role: 'First Party', email: 'jane.doe@example.com' } + { role: 'Employee', email: 'john.doe@example.com' }, + { role: 'Employee', email: 'jane.doe@example.com' } ] }.to_json @@ -189,7 +189,7 @@ describe 'Submission API' do send_email: true, submitters: [ { email: 'jane.doe@example.com' }, - { role: 'First Party', email: 'john.doe@example.com' } + { role: 'Employee', email: 'john.doe@example.com' } ] }.to_json @@ -202,7 +202,7 @@ describe 'Submission API' do template_id: templates[0].id, send_email: true, submitters: [ - { role: 'First Party', email: 'john.doe@example.com' } + { role: 'Employee', email: 'john.doe@example.com' } ], message: { subject: 'Custom Email Subject' diff --git a/spec/requests/templates_spec.rb b/spec/requests/templates_spec.rb index 7763d8cd..a6df983e 100644 --- a/spec/requests/templates_spec.rb +++ b/spec/requests/templates_spec.rb @@ -197,7 +197,7 @@ describe 'Templates API' do fields: template.fields, submitters: [ { - name: 'First Party', + name: 'Employee', uuid: template.submitters.first['uuid'] } ],