Merge pull request #20 from CareerPlug/CP-10278

CP-10278 - Hardcode Employee/Manager parties
pull/544/head
Bernardo Anderson 3 months ago committed by GitHub
commit c14f217812
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -131,6 +131,8 @@ label.primary-button {
:root { :root {
--tooltip-color: black; --tooltip-color: black;
--employee-color: #FFD687;
--manager-color: #D6E4FD;
} }
.tooltip-bottom-end:before { .tooltip-bottom-end:before {
@ -205,3 +207,28 @@ label.primary-button {
outline-offset: 3px; outline-offset: 3px;
outline-color: hsl(var(--bc) / 0.2); 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);
}

@ -447,8 +447,8 @@ export default {
}, },
borderColors () { borderColors () {
return [ return [
'border-red-500/80', 'border-employee-color',
'border-sky-500/80', 'border-manager-color',
'border-emerald-500/80', 'border-emerald-500/80',
'border-yellow-300/80', 'border-yellow-300/80',
'border-purple-600/80', 'border-purple-600/80',
@ -461,8 +461,8 @@ export default {
}, },
bgColors () { bgColors () {
return [ return [
'bg-red-100', 'bg-employee-bg-color',
'bg-sky-100', 'bg-manager-bg-color',
'bg-emerald-100', 'bg-emerald-100',
'bg-yellow-100', 'bg-yellow-100',
'bg-purple-100', 'bg-purple-100',

@ -287,8 +287,8 @@ export default {
computed: { computed: {
colors () { colors () {
return [ return [
'bg-red-500', 'bg-employee-color',
'bg-sky-500', 'bg-manager-color',
'bg-emerald-500', 'bg-emerald-500',
'bg-yellow-300', 'bg-yellow-300',
'bg-purple-600', 'bg-purple-600',

@ -77,8 +77,8 @@ const en = {
add_option: 'Add option', add_option: 'Add option',
option: 'Option', option: 'Option',
condition: 'Condition', condition: 'Condition',
first_party: 'First Party', first_party: 'Employee',
second_party: 'Second Party', second_party: 'Manager',
third_party: 'Third Party', third_party: 'Third Party',
fourth_party: 'Fourth Party', fourth_party: 'Fourth Party',
fifth_party: 'Fifth Party', fifth_party: 'Fifth Party',

@ -39,7 +39,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 Party' DEFAULT_SUBMITTER_NAME = 'Employee'
belongs_to :author, class_name: 'User' belongs_to :author, class_name: 'User'
belongs_to :account belongs_to :account

@ -41,7 +41,7 @@
"submitters": [ "submitters": [
{ {
"name": "John Doe", "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@') %>", "email": "<%= current_user.email.sub('@', '+test@') %>",
"values": { "values": {
"Form Text Field Name": "Default Value" "Form Text Field Name": "Default Value"

@ -43,7 +43,7 @@ en: &en
invalid_code: Invalid code invalid_code: Invalid code
unarchive: Unarchive unarchive: Unarchive
signed: Signed signed: Signed
first_party: 'First Party' first_party: 'Employee'
remove_filter: Remove filter remove_filter: Remove filter
add: Add add: Add
adding: Adding adding: Adding

@ -18,11 +18,12 @@ FactoryBot.define do
end end
after(:create) do |template, ev| 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| template.submitters = Array.new(ev.submitter_count) do |i|
{ {
'name' => "#{number_words[i]&.capitalize} Party", 'name' => party_names[i],
'uuid' => SecureRandom.uuid 'uuid' => SecureRandom.uuid
} }
end end

@ -45,7 +45,7 @@ RSpec.describe 'ATS Prefill Integration', type: :request do
author: user, author: user,
folder: template_folder, folder: template_folder,
fields: template_fields, fields: template_fields,
submitters: [{ 'name' => 'First Party', 'uuid' => 'submitter-uuid-1' }]) submitters: [{ 'name' => 'Employee', 'uuid' => 'submitter-uuid-1' }])
end end
let(:submission) do let(:submission) do
@ -54,7 +54,7 @@ RSpec.describe 'ATS Prefill Integration', type: :request do
account: account, account: account,
created_by_user: user, created_by_user: user,
template_fields: template_fields, template_fields: template_fields,
template_submitters: [{ 'name' => 'First Party', 'uuid' => 'submitter-uuid-1' }]) template_submitters: [{ 'name' => 'Employee', 'uuid' => 'submitter-uuid-1' }])
end end
let(:submitter) do let(:submitter) do

@ -77,7 +77,7 @@ describe 'Submission API' do
post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: { post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: {
template_id: templates[0].id, template_id: templates[0].id,
send_email: true, send_email: true,
submitters: [{ role: 'First Party', email: 'john.doe@example.com' }] submitters: [{ role: 'Employee', email: 'john.doe@example.com' }]
}.to_json }.to_json
expect(response).to have_http_status(:ok) 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: { post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: {
template_id: templates[0].id, template_id: templates[0].id,
send_email: true, send_email: true,
submitters: [{ role: 'First Party', email: 'john.doe@example.com' }], submitters: [{ role: 'Employee', email: 'john.doe@example.com' }],
message: {} message: {}
}.to_json }.to_json
@ -105,7 +105,7 @@ describe 'Submission API' do
it 'creates a submission when the submitter is marked as completed' 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: { post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: {
template_id: templates[0].id, 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 }.to_json
expect(response).to have_http_status(:ok) expect(response).to have_http_status(:ok)
@ -122,7 +122,7 @@ describe 'Submission API' do
template_id: multiple_submitters_template.id, template_id: multiple_submitters_template.id,
send_email: true, send_email: true,
submitters: [ submitters: [
{ role: 'First Party', email: 'john.doe@example.com' }, { role: 'Employee', email: 'john.doe@example.com' },
{ email: 'jane.doe@example.com' }, { email: 'jane.doe@example.com' },
{ email: 'mike.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).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[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[1]['email']).to eq('jane.doe@example.com')
expect(response.parsed_body[2]['role']).to eq('Third Party') expect(response.parsed_body[2]['role']).to eq('Third Party')
expect(response.parsed_body[2]['email']).to eq('mike.doe@example.com') 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, template_id: templates[0].id,
send_email: true, send_email: true,
submitters: [ submitters: [
{ role: 'First Party', email: 'john@example' } { role: 'Employee', email: 'john@example' }
] ]
}.to_json }.to_json
@ -162,7 +162,7 @@ describe 'Submission API' do
post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: { post '/api/submissions', headers: { 'x-auth-token': author.access_token.token }, params: {
template_id: templates[0].id, template_id: templates[0].id,
send_email: true, send_email: true,
submitters: [{ role: 'First Party', email: 'john.doe@example.com' }] submitters: [{ role: 'Employee', email: 'john.doe@example.com' }]
}.to_json }.to_json
expect(response).to have_http_status(:unprocessable_entity) expect(response).to have_http_status(:unprocessable_entity)
@ -174,8 +174,8 @@ describe 'Submission API' do
template_id: multiple_submitters_template.id, template_id: multiple_submitters_template.id,
send_email: true, send_email: true,
submitters: [ submitters: [
{ role: 'First Party', email: 'john.doe@example.com' }, { role: 'Employee', email: 'john.doe@example.com' },
{ role: 'First Party', email: 'jane.doe@example.com' } { role: 'Employee', email: 'jane.doe@example.com' }
] ]
}.to_json }.to_json
@ -189,7 +189,7 @@ describe 'Submission API' do
send_email: true, send_email: true,
submitters: [ submitters: [
{ email: 'jane.doe@example.com' }, { email: 'jane.doe@example.com' },
{ role: 'First Party', email: 'john.doe@example.com' } { role: 'Employee', email: 'john.doe@example.com' }
] ]
}.to_json }.to_json
@ -202,7 +202,7 @@ describe 'Submission API' do
template_id: templates[0].id, template_id: templates[0].id,
send_email: true, send_email: true,
submitters: [ submitters: [
{ role: 'First Party', email: 'john.doe@example.com' } { role: 'Employee', email: 'john.doe@example.com' }
], ],
message: { message: {
subject: 'Custom Email Subject' subject: 'Custom Email Subject'

@ -197,7 +197,7 @@ describe 'Templates API' do
fields: template.fields, fields: template.fields,
submitters: [ submitters: [
{ {
name: 'First Party', name: 'Employee',
uuid: template.submitters.first['uuid'] uuid: template.submitters.first['uuid']
} }
], ],

Loading…
Cancel
Save