Employer table broken up and new idcard module setup
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
class EmployersController < ApplicationController
|
class EmployersController < ApplicationController
|
||||||
|
|
||||||
|
# View Methods
|
||||||
def index
|
def index
|
||||||
@employers = Employer.all
|
@employers = Employer.all
|
||||||
end
|
end
|
||||||
@@ -12,16 +14,6 @@ class EmployersController < ApplicationController
|
|||||||
render :new
|
render :new
|
||||||
end
|
end
|
||||||
|
|
||||||
def import
|
|
||||||
word_doc = params[:employer][:import_from_word]
|
|
||||||
if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile)
|
|
||||||
@employer = BenefitsWordDocProcessor.new(word_doc.tempfile).call
|
|
||||||
else
|
|
||||||
@employer = Employer.new
|
|
||||||
end
|
|
||||||
render :new
|
|
||||||
end
|
|
||||||
|
|
||||||
# def import_old
|
# def import_old
|
||||||
# word_doc = params[:employer][:import_from_word]
|
# word_doc = params[:employer][:import_from_word]
|
||||||
# @plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
# @plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||||
@@ -74,6 +66,18 @@ class EmployersController < ApplicationController
|
|||||||
# redirect_to resources_url, notice: 'Resource was successfully destroyed.'
|
# redirect_to resources_url, notice: 'Resource was successfully destroyed.'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# API Methods
|
||||||
|
|
||||||
|
def import
|
||||||
|
word_doc = params[:employer][:import_from_word]
|
||||||
|
if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile)
|
||||||
|
@employer = BenefitsWordDocProcessor.new(word_doc.tempfile).call
|
||||||
|
else
|
||||||
|
@employer = Employer.new
|
||||||
|
end
|
||||||
|
render :new
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# def process_logos(employer_setup_process_params)
|
# def process_logos(employer_setup_process_params)
|
||||||
|
|||||||
@@ -1,27 +1,18 @@
|
|||||||
class IdCard::EmployerLogosController < ApplicationController
|
module IdCard
|
||||||
|
class EmployerLogosController < ApplicationController
|
||||||
|
|
||||||
|
# View Methods
|
||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
end
|
end
|
||||||
|
|
||||||
def image
|
|
||||||
logo_file = IdCard::EmployerLogo.find(params[:id])
|
|
||||||
puts params[:id]
|
|
||||||
logo_binary = logo_file.image_data
|
|
||||||
logo_filename = logo_file.filename
|
|
||||||
|
|
||||||
send_data logo_binary,
|
|
||||||
filename: logo_filename,
|
|
||||||
disposition: 'inline'
|
|
||||||
end
|
|
||||||
|
|
||||||
def new
|
def new
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
file = card_logo_file_params["logo_file"]
|
file = logo_params["logo_file"]
|
||||||
if file.present? && file.is_a?(ActionDispatch::Http::UploadedFile)
|
if file.present? && file.is_a?(ActionDispatch::Http::UploadedFile)
|
||||||
filename = file.original_filename
|
filename = file.original_filename
|
||||||
# binary_data = file.read
|
# binary_data = file.read
|
||||||
@@ -47,10 +38,24 @@ class IdCard::EmployerLogosController < ApplicationController
|
|||||||
def destroy
|
def destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# API Methods
|
||||||
|
|
||||||
|
def image
|
||||||
|
logo_file = IdCard::EmployerLogo.find(params[:id])
|
||||||
|
puts params[:id]
|
||||||
|
logo_binary = logo_file.image_data
|
||||||
|
logo_filename = logo_file.filename
|
||||||
|
|
||||||
|
send_data logo_binary,
|
||||||
|
filename: logo_filename,
|
||||||
|
disposition: 'inline'
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def card_logo_file_params
|
def logo_params
|
||||||
params.require(:card_logo_file).permit(:logo_file, :logo_type)
|
params.require(:id_card_employer_logo).permit(:logo_file)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
class IdCard::SetupController < ApplicationController
|
module IdCard
|
||||||
|
class SetupController < ApplicationController
|
||||||
|
|
||||||
|
# View Methods
|
||||||
def new
|
def new
|
||||||
@employer = Employer.find_by(slug: params[:employer])
|
@employer = Employer.find_by(slug: params[:employer])
|
||||||
@setup = @employer.id_card_setup.new
|
@setup = @employer.create_id_card_setup
|
||||||
render :new
|
render :new
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
xyz
|
||||||
employer_params = Employer.permitted_params(params)
|
employer_params = Employer.permitted_params(params)
|
||||||
puts "---Params---"
|
puts "---Params---"
|
||||||
puts employer_params
|
puts employer_params
|
||||||
@@ -46,6 +49,8 @@ class IdCard::SetupController < ApplicationController
|
|||||||
# redirect_to resources_url, notice: 'Resource was successfully destroyed.'
|
# redirect_to resources_url, notice: 'Resource was successfully destroyed.'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# API Methods
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# def process_logos(employer_setup_process_params)
|
# def process_logos(employer_setup_process_params)
|
||||||
@@ -234,3 +239,4 @@ class IdCard::SetupController < ApplicationController
|
|||||||
# (1..14).map { |i| i.to_s.to_sym }.push(:plan_id)
|
# (1..14).map { |i| i.to_s.to_sym }.push(:plan_id)
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ export default class extends Controller {
|
|||||||
logoType: String,
|
logoType: String,
|
||||||
employerName: String
|
employerName: String
|
||||||
}
|
}
|
||||||
static targets = ["preview", "previewContainer", "logoSelect", "logofield", "initialLogoFile"];
|
static targets = ["preview", "previewContainer", "logoSelect", "logoField", "initialLogoFile"];
|
||||||
|
|
||||||
async connect() {
|
async connect() {
|
||||||
console.log('in connect');
|
console.log('in connect');
|
||||||
const initValue = this.logofieldTarget.value
|
const initValue = this.logoFieldTarget.value
|
||||||
console.log(initValue)
|
console.log(initValue)
|
||||||
if (initValue) {
|
if (initValue) {
|
||||||
const response = await fetch(`/id_card/${this.logoTypeValue}_logos/${initValue}/image`); // Fetch the binary data
|
const response = await fetch(`/id_card/${this.logoTypeValue}_logos/${initValue}/image`); // Fetch the binary data
|
||||||
@@ -25,41 +25,49 @@ export default class extends Controller {
|
|||||||
uploadLogo(event) {
|
uploadLogo(event) {
|
||||||
console.log('in uploadLogo');
|
console.log('in uploadLogo');
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
const file = event.target.files[0];
|
let logoFile = event.target.files[0];
|
||||||
if (!file) return;
|
if (!logoFile) return;
|
||||||
|
|
||||||
const logoType = this.logoTypeValue
|
const logoType = this.logoTypeValue
|
||||||
|
|
||||||
let newFileName = file.name
|
let newFileName = logoFile.name
|
||||||
if (logoType == "network") {
|
if (logoType == "network") {
|
||||||
console.log("n " + newFileName);
|
console.log("n " + newFileName);
|
||||||
newFileName = this.determineNetworkFilename(file)
|
newFileName = this.determineNetworkFilename(logoFile)
|
||||||
this.addOptionToSelect(newFileName)
|
this.addOptionToSelect(newFileName)
|
||||||
|
logoFile = new File([logoFile], newFileName)
|
||||||
} else if (logoType == "employer") {
|
} else if (logoType == "employer") {
|
||||||
newFileName = this.determineEmployerFilename(file)
|
newFileName = this.determineEmployerFilename(logoFile)
|
||||||
file.name = newFileName
|
logoFile = new File([logoFile], newFileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.previewFile(file);
|
this.uploadLogoToServer(logoFile)
|
||||||
this.uploadLogoToServer(file);
|
.then((result) => {
|
||||||
|
console.log(result);
|
||||||
this.logofieldTarget.value = newFileName;
|
const logoId = result.id
|
||||||
|
this.previewFile(logoFile);
|
||||||
|
this.logoFieldTarget.value = logoId;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
// Handle any errors that occurred
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
previewFile(file) {
|
previewFile(logoFile) {
|
||||||
console.log('in previewFile');
|
console.log('in previewFile');
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = (e) => {
|
reader.onload = (e) => {
|
||||||
this.previewTarget.src = e.target.result;
|
this.previewTarget.src = e.target.result;
|
||||||
this.previewContainerTarget.classList.remove("hidden");
|
this.previewContainerTarget.classList.remove("hidden");
|
||||||
};
|
};
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(logoFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
async uploadLogoToServer(file) {
|
async uploadLogoToServer(logoFile) {
|
||||||
console.log('in uploadLogoToServer');
|
console.log('in uploadLogoToServer');
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append(`id_card_${this.logoTypeValue}_logo[logo_file]`, file);
|
formData.append(`id_card_${this.logoTypeValue}_logo[logo_file]`, logoFile);
|
||||||
|
|
||||||
const csrfToken = document.querySelector("meta[name='csrf-token']").content;
|
const csrfToken = document.querySelector("meta[name='csrf-token']").content;
|
||||||
|
|
||||||
@@ -74,11 +82,14 @@ export default class extends Controller {
|
|||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
console.log('Upload successful!')
|
console.log('Upload successful!')
|
||||||
|
const data = await response.json();
|
||||||
|
return data;
|
||||||
} else {
|
} else {
|
||||||
console.error("Failed to track event.");
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Network error:", error);
|
console.error("Network error:", error);
|
||||||
|
throw new Error("Network error:", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,17 +97,17 @@ export default class extends Controller {
|
|||||||
const blankOptionIndex = 0;
|
const blankOptionIndex = 0;
|
||||||
const newOption = new Option(name, name, true, true)
|
const newOption = new Option(name, name, true, true)
|
||||||
|
|
||||||
if (this.logofieldTarget.options.length > blankOptionIndex + 1) {
|
if (this.logoFieldTarget.options.length > blankOptionIndex + 1) {
|
||||||
this.logofieldTarget.insertBefore(newOption, this.logofieldTarget.options[blankOptionIndex + 1]);
|
this.logoFieldTarget.insertBefore(newOption, this.logoFieldTarget.options[blankOptionIndex + 1]);
|
||||||
} else {
|
} else {
|
||||||
this.logofieldTarget.appendChild(newOption);
|
this.logoFieldTarget.appendChild(newOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logofieldTarget.value = name;
|
this.logoFieldTarget.value = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
determineNetworkFilename(file) {
|
determineNetworkFilename(logoFile) {
|
||||||
const fileExtension = file.name.split('.').pop();
|
const fileExtension = logoFile.name.split('.').pop();
|
||||||
const primaryNetworkName = prompt("Enter the name for the primary network (Usually 'Cigna' or 'MedCost':");
|
const primaryNetworkName = prompt("Enter the name for the primary network (Usually 'Cigna' or 'MedCost':");
|
||||||
const secondaryNetworkName = prompt("Enter the name for the primary network (ex: Health Partners):");
|
const secondaryNetworkName = prompt("Enter the name for the primary network (ex: Health Partners):");
|
||||||
const logoFilename = this.titleizeText(primaryNetworkName).concat(this.titleizeText(secondaryNetworkName)).concat("Logo.").concat(fileExtension).replaceAll(' ', '');
|
const logoFilename = this.titleizeText(primaryNetworkName).concat(this.titleizeText(secondaryNetworkName)).concat("Logo.").concat(fileExtension).replaceAll(' ', '');
|
||||||
@@ -104,8 +115,8 @@ export default class extends Controller {
|
|||||||
return logoFilename
|
return logoFilename
|
||||||
}
|
}
|
||||||
|
|
||||||
determineEmployerFilename(file) {
|
determineEmployerFilename(logoFile) {
|
||||||
const fileExtension = file.name.split('.').pop();
|
const fileExtension = logoFile.name.split('.').pop();
|
||||||
const employerName = this.employerNameValue
|
const employerName = this.employerNameValue
|
||||||
const logoFilename = this.titleizeText(employerName).concat("Logo.").concat(fileExtension).replaceAll(' ', '');
|
const logoFilename = this.titleizeText(employerName).concat("Logo.").concat(fileExtension).replaceAll(' ', '');
|
||||||
|
|
||||||
@@ -120,3 +131,4 @@ export default class extends Controller {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Employer < ApplicationRecord
|
class Employer < ApplicationRecord
|
||||||
has_many :members
|
has_many :members
|
||||||
has_one :id_card_setup, class_name: 'IdCard::Setup'
|
has_one :id_card_setup, class_name: 'IdCard::Setup', dependent: :destroy
|
||||||
|
|
||||||
scope :active, -> { where(active: true) }
|
scope :active, -> { where(active: true) }
|
||||||
scope :inactive, -> { where(active: false) }
|
scope :inactive, -> { where(active: false) }
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
class IdCard::EmployerLogo < ApplicationRecord
|
module IdCard
|
||||||
|
class EmployerLogo < ApplicationRecord
|
||||||
before_save :calculate_aspect_ratio, if: :image_data_changed?
|
before_save :calculate_aspect_ratio, if: :image_data_changed?
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -12,3 +13,4 @@ class IdCard::EmployerLogo < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
class IdCard::Exception < ApplicationRecord
|
module IdCard
|
||||||
belongs_to :id_card_setup
|
class Exception < ApplicationRecord
|
||||||
has_many :id_card_exception_items
|
belongs_to :setup
|
||||||
accepts_nested_attributes_for :id_card_exception_items, allow_destroy: true, reject_if: :all_blank
|
has_many :exception_items
|
||||||
|
accepts_nested_attributes_for :exception_items, allow_destroy: true, reject_if: :all_blank
|
||||||
|
|
||||||
VALID_TYPES = ['zipcode', 'state', 'family_id']
|
VALID_TYPES = ['zipcode', 'state', 'family_id']
|
||||||
|
|
||||||
validates :type, inclusion: { in: VALID_TYPES,
|
validates :type, inclusion: { in: VALID_TYPES,
|
||||||
message: "%{value} is not a valid exception type" }
|
message: "%{value} is not a valid exception type" }
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
class IdCard::ExceptionItem < ApplicationRecord
|
module IdCard
|
||||||
belongs_to :id_card_exception
|
class ExceptionItem < ApplicationRecord
|
||||||
belongs_to :id_card_network_logo, optional: true
|
belongs_to :exception
|
||||||
belongs_to :id_card_provider_section, optional: true
|
belongs_to :network_logo, optional: true
|
||||||
|
belongs_to :provider_section, optional: true
|
||||||
|
|
||||||
validate :only_one_exception_field_present
|
validate :only_one_exception_field_present
|
||||||
|
|
||||||
@@ -23,3 +24,4 @@ class IdCard::ExceptionItem < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
class IdCard::NetworkLogo < ApplicationRecord
|
module IdCard
|
||||||
|
class NetworkLogo < ApplicationRecord
|
||||||
before_save :round_aspect_ratio
|
before_save :round_aspect_ratio
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -9,3 +10,4 @@ class IdCard::NetworkLogo < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
class IdCard::Plan < ApplicationRecord
|
module IdCard
|
||||||
belongs_to :id_card_setup
|
class Plan < ApplicationRecord
|
||||||
has_many :id_card_plan_benefits, dependent: :destroy
|
belongs_to :setup
|
||||||
accepts_nested_attributes_for :id_card_plan_benefits, allow_destroy: true, reject_if: :all_blank
|
has_many :plan_benefits, dependent: :destroy
|
||||||
|
accepts_nested_attributes_for :plan_benefits, allow_destroy: true, reject_if: :all_blank
|
||||||
|
|
||||||
# after_initialize :create_default_benefits, if: :new_record?
|
# after_initialize :create_default_benefits, if: :new_record?
|
||||||
|
|
||||||
@@ -31,3 +32,4 @@ class IdCard::Plan < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
class IdCard::PlanBenefit < ApplicationRecord
|
module IdCard
|
||||||
belongs_to :id_card_plan
|
class PlanBenefit < ApplicationRecord
|
||||||
|
belongs_to :plan
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
class IdCard::PrintData < ApplicationRecord
|
module IdCard
|
||||||
|
class PrintData < ApplicationRecord
|
||||||
|
|
||||||
STRING_ATTRIBUTES = %w[provider_line_1 provider_line_2 provider_line_3 provider_line_4 provider_line_5 provider_line_6 provider_line_7 provider_line_8 provider_line_9 provider_line_10 provider_line_11 claim_to_1 claim_to_2 claim_to_3 claim_to_4 claim_to_5 claim_to_6 claim_to_7 claim_to_8 claim_to_9 claim_to_10 claim_to_11 dependent_1 dependent_2 dependent_3 dependent_4 dependent_5 dependent_6 dependent_7 dependent_8]
|
STRING_ATTRIBUTES = %w[provider_line_1 provider_line_2 provider_line_3 provider_line_4 provider_line_5 provider_line_6 provider_line_7 provider_line_8 provider_line_9 provider_line_10 provider_line_11 claim_to_1 claim_to_2 claim_to_3 claim_to_4 claim_to_5 claim_to_6 claim_to_7 claim_to_8 claim_to_9 claim_to_10 claim_to_11 dependent_1 dependent_2 dependent_3 dependent_4 dependent_5 dependent_6 dependent_7 dependent_8]
|
||||||
|
|
||||||
@@ -10,5 +11,5 @@ class IdCard::PrintData < ApplicationRecord
|
|||||||
self[attr] = "" if self[attr].blank?
|
self[attr] = "" if self[attr].blank?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
class IdCard::ProviderSection < ApplicationRecord
|
module IdCard
|
||||||
|
class ProviderSection < ApplicationRecord
|
||||||
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
class IdCard::RxSection < ApplicationRecord
|
module IdCard
|
||||||
|
class RxSection < ApplicationRecord
|
||||||
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
@@ -1,18 +1,21 @@
|
|||||||
class IdCard::Setup < ApplicationRecord
|
module IdCard
|
||||||
belongs_to :employer
|
class Setup < ApplicationRecord
|
||||||
belongs_to :id_card_employer_logo
|
belongs_to :employer, class_name: 'Employer'
|
||||||
belongs_to :id_card_network_logo
|
belongs_to :employer_logo, optional: true
|
||||||
belongs_to :id_card_provider_section
|
belongs_to :network_logo, optional: true
|
||||||
belongs_to :id_card_rx_section
|
belongs_to :provider_section, optional: true
|
||||||
|
belongs_to :rx_section, optional: true
|
||||||
|
|
||||||
has_many :card_exceptions, dependent: :destroy
|
has_many :plans, dependent: :destroy
|
||||||
|
|
||||||
|
has_many :exceptions, dependent: :destroy
|
||||||
|
|
||||||
# def employer_logo_filename
|
# def employer_logo_filename
|
||||||
# self.id_card_employer_logo.filename
|
# self.employer_logo.filename
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# def network_logo_filename
|
# def network_logo_filename
|
||||||
# self.id_card_network_logo.filename
|
# self.network_logo.filename
|
||||||
# end
|
# end
|
||||||
|
|
||||||
def self.permitted_params(params)
|
def self.permitted_params(params)
|
||||||
@@ -25,3 +28,4 @@ class IdCard::Setup < ApplicationRecord
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ module BenefitsWordDoc
|
|||||||
plan_lines = @word_doc_section.slice(plan_index + 1, 14)
|
plan_lines = @word_doc_section.slice(plan_index + 1, 14)
|
||||||
plan_lines.each_with_index do |line, i|
|
plan_lines.each_with_index do |line, i|
|
||||||
field_mapping = mapping_array[i]
|
field_mapping = mapping_array[i]
|
||||||
|
if line.match(/:.*/)
|
||||||
|
field_value = line.match(/:.*/)[0].strip
|
||||||
|
else
|
||||||
field_regex = field_mapping[:doc_to_employer_regex]
|
field_regex = field_mapping[:doc_to_employer_regex]
|
||||||
if line.match(field_regex)
|
if line.match(field_regex)
|
||||||
field_value = line.match(field_regex)[0].strip
|
field_value = line.match(field_regex)[0].strip
|
||||||
@@ -23,6 +26,7 @@ module BenefitsWordDoc
|
|||||||
else
|
else
|
||||||
field_value = line
|
field_value = line
|
||||||
end
|
end
|
||||||
|
end
|
||||||
employer_benefit_desc_field = field_mapping[:employer_benefit_desc_field]
|
employer_benefit_desc_field = field_mapping[:employer_benefit_desc_field]
|
||||||
new_benefit = new_plan.plan_benefits[i]
|
new_benefit = new_plan.plan_benefits[i]
|
||||||
new_benefit.benefit = field_value
|
new_benefit.benefit = field_value
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class ImageProcessor
|
|||||||
filename: filename,
|
filename: filename,
|
||||||
image_data: binary_data,
|
image_data: binary_data,
|
||||||
content_type: meme_type,
|
content_type: meme_type,
|
||||||
logo_type: "network"
|
logo_type: "employer"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -23,7 +23,7 @@ module SampleCard
|
|||||||
def set_employer_fields
|
def set_employer_fields
|
||||||
selected_attributes = {
|
selected_attributes = {
|
||||||
employer_name: @employer.name,
|
employer_name: @employer.name,
|
||||||
group_number: @employer.group_number || "999999",
|
group_number: @employer.group_number.present? ? @employer.group_number : "999999",
|
||||||
medical_eff_date: @employer.effective_date
|
medical_eff_date: @employer.effective_date
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ module SampleCard
|
|||||||
selected_attributes = {
|
selected_attributes = {
|
||||||
full_name: "JANE DOE",
|
full_name: "JANE DOE",
|
||||||
primary_mb_member_key: "888888",
|
primary_mb_member_key: "888888",
|
||||||
rx_group: @employer.group_number || "999999"
|
rx_group: @employer.group_number.present? ? @employer.group_number : "999999"
|
||||||
}
|
}
|
||||||
|
|
||||||
@sample_card.assign_attributes(selected_attributes)
|
@sample_card.assign_attributes(selected_attributes)
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<div class="bg-deepcove h-full w-full flex flex-col">
|
<div class="bg-deepcove h-full w-full flex flex-col">
|
||||||
<div class="flex justify-between my-5 font-bold text-4xl">
|
<div class="flex space-x-6 my-5 font-bold text-4xl">
|
||||||
<h1 class="text-platinum">New ID Card Setup:</h1>
|
<h1 class="text-platinum">New ID Card Setup:</h1>
|
||||||
<h1 class="text-verdigris">(<%= @employer.name %>)</h1>
|
<h1 class="text-verdigris">(<%= @employer.name %>)</h1>
|
||||||
</div>
|
</div>
|
||||||
<%= form_with model: @setup, local: true, multipart: true do |f| %>
|
<%= form_with model: @setup, local: true, multipart: true do |f| %>
|
||||||
|
<%= form_with model: @employer, url: import_employers_path, data: { turbo: false }, local: true, multipart: true do |form| %>
|
||||||
<div class="flex flex-col space-y-6 pb-10">
|
<div class="flex flex-col space-y-6 pb-10">
|
||||||
<div class="flex w-full items-end" data-controller="logo-upload" data-logo-upload-logo-type-value="employer" data-logo-upload-employer-name-value=<%= @employer.name %>>
|
<div class="flex w-full items-end" data-controller="logo-upload" data-logo-upload-logo-type-value="employer" data-logo-upload-employer-name-value=<%= @employer.name %>>
|
||||||
<div class="flex flex-col space-y-6 w-2/5">
|
<div class="flex flex-col space-y-6 w-2/5">
|
||||||
@@ -25,7 +26,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="flex items-end">
|
<div class="flex items-end">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="text-platinum">Employer Logo</div>
|
<div class="text-platinum text-lg">Employer Logo</div>
|
||||||
<div class="flex items-center justify-center self-end cursor-pointer bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-r h-10 transition duration-100">
|
<div class="flex items-center justify-center self-end cursor-pointer bg-atmosphere hover:bg-deepcove border-2 border-atmosphere text-platinum font-bold px-3 rounded-r h-10 transition duration-100">
|
||||||
<label for="employer_logo_file" class="text-center cursor-pointer">
|
<label for="employer_logo_file" class="text-center cursor-pointer">
|
||||||
<%= icon "image-plus", library: "lucide" %>
|
<%= icon "image-plus", library: "lucide" %>
|
||||||
@@ -35,13 +36,13 @@
|
|||||||
<div class="hidden flex justify-center ml-15 rounded-lg border-4 border-atmosphere" data-logo-upload-target="previewContainer">
|
<div class="hidden flex justify-center ml-15 rounded-lg border-4 border-atmosphere" data-logo-upload-target="previewContainer">
|
||||||
<img data-logo-upload-target="preview" src="#" alt="Employer Logo preview" class="max-h-[100px] max-w-[133px] bg-platinum m-1"/>
|
<img data-logo-upload-target="preview" src="#" alt="Employer Logo preview" class="max-h-[100px] max-w-[133px] bg-platinum m-1"/>
|
||||||
</div>
|
</div>
|
||||||
<%= f.hidden_field :id_card_employer_logo_id, data: { logo_upload_target: "logofield", logo_upload_target: "employer" } %>
|
<%= f.hidden_field :employer_logo_id, label: { text: "Employer Logo" }, data: { logo_upload_target: "logoField" } %>
|
||||||
<%= f.file_field :add_or_update_logo, class: "hidden", id: "employer_logo_file", data: { logo_upload_target: "previewContainer", parent_value: "network_logo", action: "change->logo-upload#uploadLogo" }, direct_upload: true %>
|
<%= f.file_field :logo_file, class: "hidden", id: "employer_logo_file", data: { logo_upload_target: "previewContainer", parent_value: "network_logo", action: "change->logo-upload#uploadLogo" }, direct_upload: true %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="py-8">
|
<div class="py-8">
|
||||||
<%= f.submit "Create New Employer" %>
|
<%= f.submit "Create ID Card Setup" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -15,6 +15,8 @@ services:
|
|||||||
- HISTFILE=/usr/src/app/log/.bash_history
|
- HISTFILE=/usr/src/app/log/.bash_history
|
||||||
- RAILS_ENV=development
|
- RAILS_ENV=development
|
||||||
- TAILWIND_POLLING=true
|
- TAILWIND_POLLING=true
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=100
|
||||||
tty: true
|
tty: true
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ class CreateIdCardSetups < ActiveRecord::Migration[7.2]
|
|||||||
t.string :rx_group_number
|
t.string :rx_group_number
|
||||||
t.boolean :active, default: false
|
t.boolean :active, default: false
|
||||||
t.belongs_to :employer, null: false, foreign_key: true
|
t.belongs_to :employer, null: false, foreign_key: true
|
||||||
t.belongs_to :id_card_employer_logo, null: true, foreign_key: true
|
t.belongs_to :employer_logo, null: true, foreign_key: { to_table: :id_card_employer_logos }
|
||||||
t.belongs_to :id_card_network_logo, null: true, foreign_key: true
|
t.belongs_to :network_logo, null: true, foreign_key: { to_table: :id_card_network_logos }
|
||||||
t.belongs_to :id_card_provider_section, null: false, foreign_key: true
|
t.belongs_to :provider_section, null: true, foreign_key: { to_table: :id_card_provider_sections }
|
||||||
t.belongs_to :id_card_rx_section, null: false, foreign_key: true
|
t.belongs_to :rx_section, null: true, foreign_key: { to_table: :id_card_rx_sections }
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ class CreateIdCardPlans < ActiveRecord::Migration[7.2]
|
|||||||
t.string :title
|
t.string :title
|
||||||
t.integer :pb_product_key
|
t.integer :pb_product_key
|
||||||
t.string :pl_plan_key
|
t.string :pl_plan_key
|
||||||
t.belongs_to :id_card_setup, null: true, foreign_key: true
|
t.boolean :template
|
||||||
|
t.belongs_to :setup, null: true, foreign_key: { to_table: :id_card_setups }
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class CreateIdCardPlanBenefits < ActiveRecord::Migration[7.2]
|
|||||||
t.string :benefit_desc
|
t.string :benefit_desc
|
||||||
t.string :benefit
|
t.string :benefit
|
||||||
t.integer :sequence
|
t.integer :sequence
|
||||||
t.belongs_to :id_card_plan, null: false, foreign_key: true
|
t.belongs_to :plan, null: false, foreign_key: { to_table: :id_card_plans }
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class CreateIdCardExceptions < ActiveRecord::Migration[7.2]
|
|||||||
create_table :id_card_exceptions do |t|
|
create_table :id_card_exceptions do |t|
|
||||||
t.string :type
|
t.string :type
|
||||||
t.string :value
|
t.string :value
|
||||||
t.belongs_to :id_card_setup, null: false, foreign_key: true
|
t.belongs_to :setup, null: false, foreign_key: { to_table: :id_card_setups }
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ class CreateIdCardExceptionItems < ActiveRecord::Migration[7.2]
|
|||||||
create_table :id_card_exception_items do |t|
|
create_table :id_card_exception_items do |t|
|
||||||
t.string :field_name
|
t.string :field_name
|
||||||
t.string :field_value
|
t.string :field_value
|
||||||
t.belongs_to :id_card_exception, null: false, foreign_key: true
|
t.belongs_to :exception, null: false, foreign_key: { to_table: :id_card_exceptions }
|
||||||
t.belongs_to :id_card_network_logo, null: true, foreign_key: true
|
t.belongs_to :network_logo, null: true, foreign_key: { to_table: :id_card_network_logos }
|
||||||
t.belongs_to :id_card_provider_section, null: true, foreign_key: true
|
t.belongs_to :provider_section, null: true, foreign_key: { to_table: :id_card_provider_sections }
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
+31
-30
@@ -37,23 +37,23 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
|
|||||||
create_table "id_card_exception_items", force: :cascade do |t|
|
create_table "id_card_exception_items", force: :cascade do |t|
|
||||||
t.string "field_name"
|
t.string "field_name"
|
||||||
t.string "field_value"
|
t.string "field_value"
|
||||||
t.bigint "id_card_exception_id", null: false
|
t.bigint "exception_id", null: false
|
||||||
t.bigint "id_card_network_logo_id"
|
t.bigint "network_logo_id"
|
||||||
t.bigint "id_card_provider_section_id"
|
t.bigint "provider_section_id"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.index ["id_card_exception_id"], name: "index_id_card_exception_items_on_id_card_exception_id"
|
t.index ["exception_id"], name: "index_id_card_exception_items_on_exception_id"
|
||||||
t.index ["id_card_network_logo_id"], name: "index_id_card_exception_items_on_id_card_network_logo_id"
|
t.index ["network_logo_id"], name: "index_id_card_exception_items_on_network_logo_id"
|
||||||
t.index ["id_card_provider_section_id"], name: "index_id_card_exception_items_on_id_card_provider_section_id"
|
t.index ["provider_section_id"], name: "index_id_card_exception_items_on_provider_section_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "id_card_exceptions", force: :cascade do |t|
|
create_table "id_card_exceptions", force: :cascade do |t|
|
||||||
t.string "type"
|
t.string "type"
|
||||||
t.string "value"
|
t.string "value"
|
||||||
t.bigint "id_card_setup_id", null: false
|
t.bigint "setup_id", null: false
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.index ["id_card_setup_id"], name: "index_id_card_exceptions_on_id_card_setup_id"
|
t.index ["setup_id"], name: "index_id_card_exceptions_on_setup_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "id_card_network_logos", force: :cascade do |t|
|
create_table "id_card_network_logos", force: :cascade do |t|
|
||||||
@@ -70,20 +70,21 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
|
|||||||
t.string "benefit_desc"
|
t.string "benefit_desc"
|
||||||
t.string "benefit"
|
t.string "benefit"
|
||||||
t.integer "sequence"
|
t.integer "sequence"
|
||||||
t.bigint "id_card_plan_id", null: false
|
t.bigint "plan_id", null: false
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.index ["id_card_plan_id"], name: "index_id_card_plan_benefits_on_id_card_plan_id"
|
t.index ["plan_id"], name: "index_id_card_plan_benefits_on_plan_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "id_card_plans", force: :cascade do |t|
|
create_table "id_card_plans", force: :cascade do |t|
|
||||||
t.string "title"
|
t.string "title"
|
||||||
t.integer "pb_product_key"
|
t.integer "pb_product_key"
|
||||||
t.string "pl_plan_key"
|
t.string "pl_plan_key"
|
||||||
t.bigint "id_card_setup_id"
|
t.boolean "template"
|
||||||
|
t.bigint "setup_id"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.index ["id_card_setup_id"], name: "index_id_card_plans_on_id_card_setup_id"
|
t.index ["setup_id"], name: "index_id_card_plans_on_setup_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "id_card_print_data", force: :cascade do |t|
|
create_table "id_card_print_data", force: :cascade do |t|
|
||||||
@@ -226,17 +227,17 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
|
|||||||
t.string "rx_group_number"
|
t.string "rx_group_number"
|
||||||
t.boolean "active", default: false
|
t.boolean "active", default: false
|
||||||
t.bigint "employer_id", null: false
|
t.bigint "employer_id", null: false
|
||||||
t.bigint "id_card_employer_logo_id"
|
t.bigint "employer_logo_id"
|
||||||
t.bigint "id_card_network_logo_id"
|
t.bigint "network_logo_id"
|
||||||
t.bigint "id_card_provider_section_id", null: false
|
t.bigint "provider_section_id"
|
||||||
t.bigint "id_card_rx_section_id", null: false
|
t.bigint "rx_section_id"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
t.index ["employer_id"], name: "index_id_card_setups_on_employer_id"
|
t.index ["employer_id"], name: "index_id_card_setups_on_employer_id"
|
||||||
t.index ["id_card_employer_logo_id"], name: "index_id_card_setups_on_id_card_employer_logo_id"
|
t.index ["employer_logo_id"], name: "index_id_card_setups_on_employer_logo_id"
|
||||||
t.index ["id_card_network_logo_id"], name: "index_id_card_setups_on_id_card_network_logo_id"
|
t.index ["network_logo_id"], name: "index_id_card_setups_on_network_logo_id"
|
||||||
t.index ["id_card_provider_section_id"], name: "index_id_card_setups_on_id_card_provider_section_id"
|
t.index ["provider_section_id"], name: "index_id_card_setups_on_provider_section_id"
|
||||||
t.index ["id_card_rx_section_id"], name: "index_id_card_setups_on_id_card_rx_section_id"
|
t.index ["rx_section_id"], name: "index_id_card_setups_on_rx_section_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "members", force: :cascade do |t|
|
create_table "members", force: :cascade do |t|
|
||||||
@@ -254,17 +255,17 @@ ActiveRecord::Schema[7.2].define(version: 2026_01_16_182836) do
|
|||||||
t.index ["id_card_plan_id"], name: "index_members_on_id_card_plan_id"
|
t.index ["id_card_plan_id"], name: "index_members_on_id_card_plan_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_foreign_key "id_card_exception_items", "id_card_exceptions"
|
add_foreign_key "id_card_exception_items", "id_card_exceptions", column: "exception_id"
|
||||||
add_foreign_key "id_card_exception_items", "id_card_network_logos"
|
add_foreign_key "id_card_exception_items", "id_card_network_logos", column: "network_logo_id"
|
||||||
add_foreign_key "id_card_exception_items", "id_card_provider_sections"
|
add_foreign_key "id_card_exception_items", "id_card_provider_sections", column: "provider_section_id"
|
||||||
add_foreign_key "id_card_exceptions", "id_card_setups"
|
add_foreign_key "id_card_exceptions", "id_card_setups", column: "setup_id"
|
||||||
add_foreign_key "id_card_plan_benefits", "id_card_plans"
|
add_foreign_key "id_card_plan_benefits", "id_card_plans", column: "plan_id"
|
||||||
add_foreign_key "id_card_plans", "id_card_setups"
|
add_foreign_key "id_card_plans", "id_card_setups", column: "setup_id"
|
||||||
add_foreign_key "id_card_setups", "employers"
|
add_foreign_key "id_card_setups", "employers"
|
||||||
add_foreign_key "id_card_setups", "id_card_employer_logos"
|
add_foreign_key "id_card_setups", "id_card_employer_logos", column: "employer_logo_id"
|
||||||
add_foreign_key "id_card_setups", "id_card_network_logos"
|
add_foreign_key "id_card_setups", "id_card_network_logos", column: "network_logo_id"
|
||||||
add_foreign_key "id_card_setups", "id_card_provider_sections"
|
add_foreign_key "id_card_setups", "id_card_provider_sections", column: "provider_section_id"
|
||||||
add_foreign_key "id_card_setups", "id_card_rx_sections"
|
add_foreign_key "id_card_setups", "id_card_rx_sections", column: "rx_section_id"
|
||||||
add_foreign_key "members", "employers"
|
add_foreign_key "members", "employers"
|
||||||
add_foreign_key "members", "id_card_plans"
|
add_foreign_key "members", "id_card_plans"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user