automate employer setup import from word and manual entry working

This commit is contained in:
Jason Jordan
2025-12-03 11:42:15 -05:00
parent 3fbece7da6
commit 78ce415b94
44 changed files with 1012 additions and 339 deletions
@@ -10,9 +10,6 @@
<div class="w-1/5">
<%= f.text_field :group_number, label: { text: "Group/Medical Number" }, class: "w-full" %>
</div>
<div>
<%= f.check_box :dental %>
</div>
</div>
<div class="flex space-x-10">
<div class="w-1/5">
@@ -23,15 +20,9 @@
</div>
</div>
<div class="flex space-x-10">
<div class="w-1/5">
<%= f.select :number_of_plans, options_for_select((1..6).to_a), label: { text: "Number of Plans" }, class: "w-1/3" %>
</div>
<div class="w-1/5">
<%= f.select :network, options_for_select([["Cigna", "cig"], ["Cigna+Regional", "cig+"], ["Medcost", "med"]]), label: { text: "Provider Network" }, data: { controller: "form-toggle", action: "change->form-toggle#toggleDivs" }, class: "w-full" %>
</div>
<div id="div-a" class="w-1/5" data-form-toggle-target="divA">
<%= f.select :number_of_additional_network_logos, options_for_select((0..6).to_a), label: { text: "Number of Additional Network Logos" }, class: "w-1/3" %>
</div>
</div>
<div class="flex space-x-5 items-center mt-4">
<label for="file_upload_input" class="cursor-pointer bg-atmosphere hover:bg-bluetang text-platinum font-bold py-2 px-4 rounded border border-platinum">
@@ -0,0 +1,64 @@
<div class="min-h-screen w-full flex flex-col" data-controller="add-alt-network-logo" data-add-alt-network-logo-form-color-value="<%= EmployerSetupPlansForm::PLAN_COLORS.to_json %>">
<h1 class="font-bold text-4xl text-platinum">New Employer Setup</h1>
<h3 class="font-bold text-2xl text-bluemana">Provider Network</h3>
<%= form_with model: @form, url: employer_setup_index_path, local: true do |f| %>
<div class="flex w-full justify-start">
<div class="flex flex-wrap w-full" data-add-alt-network-logo-target="container">
<%= button_tag "Add a Regional Logo", class: "cursor-pointer text-lg font-medium py-2 px-4 rounded w-1/7 h-75 my-8 text-[#E0E0E0] rounded-lg border border-[#C2C2C2] hover:shadow-[0_0_10px_3px_#93c5fd]", data: { action: "add-alt-network-logo#add", add_alt_network_logo_target: "button" } %>
</div>
</div>
<div class="py-10">
<%= f.submit "Continue to Summary" %>
</div>
<template data-add-alt-network-logo-target="template">
<%= f.fields_for :network_exceptions, index: 'NEW_RECORD' do |network_fields| %>
<div class="flex flex-col my-8 mr-3 space-y-6 px-3" data-controller="add-network-exception">
<div class="flex space-x-5 items-center mt-4">
<label for="file_upload_input_NEW_RECORD" class="cursor-pointer bg-NEXT_COLOR hover:bg-NEXT_COLOR-tinted text-platinum font-bold py-2 px-4 rounded border border-platinum">
Choose Network Logo File
</label>
<span id="file_name_display_NEW_RECORD" class="ml-2 text-NEXT_COLOR font-semibold">No file chosen</span>
<%= network_fields.file_field :network_logo, class: "hidden", id: "file_upload_input_NEW_RECORD", data: { add_alt_network_logo_target: "networkLogo" } %>
</div>
<%= network_fields.fields_for :exceptions, index: 0 do |exception_fields| %>
<div class="flex space-x-6 w-full">
<div class="w-full">
<%= exception_fields.select :type, options_for_select(["Zip","State"]), label: { text: "Exception Type" }, prompt: "Select Type", class: "w-full" %>
</div>
<div class="w-full">
<%= exception_fields.text_field :value, label: { text: "Exception Value" }, class: "w-full" %>
</div>
</div>
<% end %>
<div class="flex flex-col w-full space-y-6" data-add-network-exception-target="container"></div>
<%= button_tag "Add an exception rule", class: "cursor-pointer bg-NEXT_COLOR hover:bg-NEXT_COLOR-tinted text-platinum text-lg font-bold py-2 px-4 rounded border border-platinum w-full", data: { action: "add-network-exception#add" } %>
<template data-add-network-exception-target="template">
<%= network_fields.fields_for :exceptions, index: 'NEW_EXC_RECORD' do |exception_fields| %>
<div class="flex space-x-6 w-full">
<div class="w-full">
<%= exception_fields.select :type, options_for_select(["Zip","State"]), label: { text: "Exception Type" }, prompt: "Select Type", class: "w-full" %>
</div>
<div class="w-full">
<%= exception_fields.text_field :value, label: { text: "Exception Value" }, class: "w-full" %>
</div>
</div>
<% end %>
</template>
</div>
<% end %>
</template>
<% end %>
</div>
<script>
const logoButtons = document.querySelectorAll('[id^="file_upload_input_"]');
logoButtons.forEach(button => {
button.addEventListener('change', function(e) {
var fileName = e.target.files[0] ? e.target.files[0].name : 'No file chosen';
var targetIndex = e.target.id.slice(-1);
document.getElementById(`file_name_display_${targetIndex}`).textContent = fileName;
});
})
</script>
@@ -1,41 +0,0 @@
<div class="bg-deepcove min-h-screen w-full flex flex-col">
<h1 class="font-bold text-4xl text-platinum">New Employer Setup</h1>
<h3 class="font-bold text-2xl text-bluemana">Provider Network</h3>
<%= form_with model: @form, url: employer_setup_index_path, local: true do |f| %>
<% @form.number_of_additional_network_logos.to_i.times do |i| %>
<%= f.fields_for :network_exceptions do |network_fields| %>
<div class="w-full flex flex-col my-8 space-y-6">
<div class="flex space-x-5 items-center mt-4">
<label for="file_upload_input" class="cursor-pointer bg-atmosphere hover:bg-bluetang text-platinum font-bold py-2 px-4 rounded border border-platinum">
Choose Network Logo File
</label>
<span id="file_name_display" class="ml-2 text-bluemana font-semibold">No file chosen</span>
<%= network_fields.file_field :network_logo, class: "hidden", id: "file_upload_input" %>
</div>
<% 2.to_i.times do |j| %>
<%= network_fields.fields_for :exceptions do |exception_fields| %>
<div class="flex space-x-10">
<div class="w-1/5">
<%= exception_fields.select :type, options_for_select(["Zipcode","State"]), label: { text: "Exception Type" }, prompt: "Select Type", class: "w-full" %>
</div>
<div class="w-1/5">
<%= exception_fields.text_field :value, label: { text: "Exception Value" }, class: "w-full" %>
</div>
</div>
<% end %>
<% end %>
</div>
<% end %>
<% end %>
<div class="py-10">
<%= f.submit "Continue to Summary" %>
</div>
<% end %>
</div>
<script>
document.getElementById('file_upload_input').addEventListener('change', function(e) {
var fileName = e.target.files[0] ? e.target.files[0].name : 'No file chosen';
document.getElementById('file_name_display').textContent = fileName;
});
</script>
@@ -1,38 +0,0 @@
<div class="bg-deepcove min-h-screen w-full flex flex-col">
<h1 class="font-bold text-4xl text-platinum">New Employer Setup</h1>
<%= form_with url: 'create_plans', method: :post do |form| %>
<div class="w-full flex">
<div class="flex flex-col mr-4">
<% @id_card_template_benefits.each do |bene| %>
<div>
<%= form.text_field "plans[benefit_descs][#{bene.sequence}]", label: { text: "Benefit Description" }, value: "#{bene.benefit_desc}" %>
</div>
<% end %>
</div>
<% @employer_data['employer']['number_of_plans'].to_i.times do |i| %>
<div class="flex flex-col">
<div>
<%= form.text_field "plans[plan_#{i}][plan_id]", label: { text: "Plan Id" } %>
</div>
<div class="bg-gray-200 rounded py-2 px-4 text-bluetang font-semibold leading-tight">
<select data-action="benefits-template-picker#fetchData" data-benefits-template-picker-url-value="/id_card_benefits_templates/get_templates_benefits/:id">
<option value="">Select Existing Template (optional)</option>
<% @id_card_templates.each do |temp| %>
<option value="<%= temp.id %>"><%= temp.name %></option>
<% end %>
</select>
</div>
<% @id_card_template_benefits.each do |bene| %>
<div>
<div>
<%= form.text_field "plans[plan_#{i}][#{bene.sequence}]", label: { text: "Benefit Value" }, data: { benefits_template_picker_target: "benefit_#{bene.sequence}" } %>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
<%= form.submit "Summary" %>
</div>
<% end %>
</div>
+56 -30
View File
@@ -1,43 +1,69 @@
<div class="bg-deepcove min-h-screen w-full flex flex-col">
<div class="min-h-screen w-full flex flex-col" data-controller="add-plan" data-add-plan-form-color-value="<%= EmployerSetupPlansForm::PLAN_COLORS.to_json %>">
<h1 class="font-bold text-4xl text-platinum">New Employer Setup</h1>
<h3 class="font-bold text-2xl text-bluemana">Medical Plans</h3>
<div class="flex flex-col pl-6">
<%= form_with model: @form, url: employer_setup_index_path, local: true do |f| %>
<%= f.text_field :pl_plan_key, label: { text: "Employer PL Plan Key" }, class: "justify-self-start" %>
<div class="w-full flex my-8">
<div class="flex flex-col justify-end pr-6">
<% @id_card_template_benefits.each do |bene| %>
<%= f.fields_for :benefit_descs do |bd_fields| %>
<div class="flex flex-wrap w-full" data-add-plan-target="container">
<div class="flex flex-col items-stretch justify-end pr-6 pl-1 w-1/4">
<%= f.fields_for :benefit_descs do |plan_benefit_fields| %>
<%= plan_benefit_fields.text_field :plan_id, class: "hidden", value: "descriptions" %>
<% @form.benefits_template.each do |bene| %>
<div>
<%= bd_fields.text_field "#{bene.sequence}", label: { text: "Benefit Description #{bene.sequence}" }, value: "#{bene.benefit_desc}" %>
<%= plan_benefit_fields.text_field "benefit_#{bene.sequence}", label: { text: "Benefit Description #{bene.sequence}" }, value: "#{bene.benefit_desc}", class: "w-full" %>
</div>
<% end %>
<% end %>
</div>
<% @form.number_of_plans.to_i.times do |i| %>
<% border_colors = ['border-atmosphere', 'border-copper', 'border-bluemana'] %>
<% text_colors = ['text-atmosphere', 'text-copper', 'text-bluemana'] %>
<div class="inline-flex flex-col justify-end pr-6 pl-1 relative">
<div class="absolute left-0 top-[2%] h-[98%] border-l-4 <%= border_colors[i] %> rounded-bl-lg"></div>
<div class="font-bold text-2xl <%= text_colors[i] %> -ml-[6px] z-2 w-full">
<%= "Plan #{i + 1}" %>
</div>
<%= f.fields_for :plans do |plan_fields| %>
<div class="pl-1 w-full">
<%= plan_fields.text_field :plan_id, label: { text: "Plan Id" }, class: "w-full" %>
</div>
<div class="pl-1" data-controller="benefits_template_picker_controller">
<%= f.select :template_id, options_from_collection_for_select(@id_card_templates, :id, :name), { prompt: "Select Existing Template (optional)", data: { action: "benefits-template-picker#fetchData" }} %>
</div>
<% @id_card_template_benefits.each do |bene| %>
<div>
<div class="pl-1 w-full">
<%= plan_fields.text_field "#{bene.sequence}", label: { text: "Benefit Value #{bene.sequence}" }, data: { benefits_template_picker_target: "benefit_#{bene.sequence}" }, class: "w-full" %>
</div>
</div>
<% end %>
<% end %>
</div>
<% end %>
<% @form.plans.each_with_index do |plan, i| %>
<div class="inline-flex flex-col justify-end pr-6 pl-1 mt-10 relative w-1/4" data-controller="benefits-template-picker">
<div class="absolute left-0 top-[2%] h-[98%] border-l-4 <%= "border-#{EmployerSetupPlansForm::PLAN_COLORS[i]}" %> rounded-bl-lg"></div>
<div class="font-bold text-2xl <%= "text-#{EmployerSetupPlansForm::PLAN_COLORS[i]}" %> -ml-[6px] z-2 w-full">
<%= "Plan #{i + 1}" %>
</div>
<%= f.fields_for :plans, index: i do |plan_fields| %>
<div class="pl-1 w-full">
<%= plan_fields.text_field :plan_id, label: { text: "Plan Id" }, class: "w-full", data: { add_plan_target: "plan" } %>
</div>
<div class="pl-1">
<%= f.select :template_id, options_from_collection_for_select(@form.plan_templates, :id, :title), { prompt: "Select Plan Template" }, { data: { action: "benefits-template-picker#fetchData" }} %>
</div>
<% @form.benefits_template.each do |bene| %>
<div>
<div class="pl-1 w-full">
<%= plan_fields.text_field "benefit_#{bene.sequence}", label: { text: "Benefit Value #{bene.sequence}" }, data: { benefits_template_picker_target: "benefit", sequence: "#{bene.sequence}"}, class: "w-full" %>
</div>
</div>
<% end %>
<% end %>
</div>
<% end %>
<%= button_tag "Add a Plan", class: "cursor-pointer text-2xl font-bold py-2 pr-6 mt-10 w-[calc(24%-1rem)] w-1/4 min-h-[940px] text-[#E0E0E0] rounded-lg font-medium border border-[#E0E0E0] bg-[#173057] hover:bg-transparent hover:shadow-[0_0_10px_3px_#93c5fd] transition-colors duration-150", data: { action: "add-plan#add", add_plan_target: "button" } %>
<template data-add-plan-target="template">
<div class="inline-flex flex-col justify-end pr-6 pl-1 mt-10 relative w-1/4" data-controller="benefits-template-picker">
<div class="absolute left-0 top-[2%] h-[98%] border-l-4 border-NEXT_COLOR rounded-bl-lg"></div>
<div class="font-bold text-2xl text-NEXT_COLOR -ml-[6px] z-2 w-full">
<%= "Plan NEW_PLAN" %>
</div>
<%= f.fields_for :plans, index: 'NEW_RECORD' do |plan_fields| %>
<div class="pl-1 w-full">
<%= plan_fields.text_field :plan_id, label: { text: "Plan Id" }, class: "w-full", data: { add_plan_target: "plan" } %>
</div>
<div class="pl-1">
<%= f.select :template_id, options_from_collection_for_select(@form.plan_templates, :id, :title), { prompt: "Select Plan Template" }, { data: { action: "benefits-template-picker#fetchData" }} %>
</div>
<% @form.benefits_template.each do |bene| %>
<div>
<div class="pl-1 w-full">
<%= plan_fields.text_field "benefit_#{bene.sequence}", label: { text: "Benefit Value #{bene.sequence}" }, data: { benefits_template_picker_target: "benefit", sequence: "#{bene.sequence}"}, class: "w-full" %>
</div>
</div>
<% end %>
<% end %>
</div>
</template>
</div>
</div>
<div class="py-10">
<%= f.submit "Continue to Provider Network" %>
+10 -4
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>Railsondocker</title>
<title>Baclight</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
@@ -11,9 +11,15 @@
<%= javascript_importmap_tags %>
</head>
<body class="w-full flex bg-deepcove">
<main class="w-11/12 mt-28 px-5 flex">
<%= yield %>
<body>
<main>
<div class="w-full h-screen flex bg-black justify-center items-center">
<div class="h-[98%] w-[calc(100%-1rem)] mt-1 mb-2 flex justify-center items-center shadow-[0_0_10px_3px_#93c5fd] rounded-xl bg-[#04153E]">
<div class="w-11/12 mt-8 px-5 flex">
<%= yield %>
</div>
</div>
</div>
</main>
</body>
</html>
+13 -16
View File
@@ -1,17 +1,14 @@
<h1>Welcome</h1>
<%= link_to "Articles", articles_path %>
<h2>Stimulus Check</h2>
<div data-controller="hello">
<input data-hello-target="name" type="text">
<button data-action="click->hello#greet">
Greet
</button>
<span data-hello-target="output">
</span>
<div class="flex items-center justify-center h-full w-full">
<div class="flex flex-col text-7xl font-bold text-[#2A4B6F] space-y-30">
<div>
<span class="[text-shadow:0_0_20px_#fff,0_0_50px_#0090D9,0_0_80px_#0ff] text-[#04153E]">B</span>acl<span class="text-[#CD7F32]">i</span>ght
</div>
<div>
<span class="[text-shadow:0_0_20px_#fff,0_0_50px_#0090D9,0_0_80px_#0ff] text-[#04153E]">B</span>acl<span class="relative inline-block">i<span class="absolute top-0 right-0 h-3 w-3 rounded-full bg-[#CD7F32] translate-y-[7px] -translate-x-[3px]"></span></span>ght
</div>
<div>
<span class="justify-self-end [text-shadow:0_0_20px_#fff,0_0_50px_#0090D9,0_0_80px_#0ff] text-[#04153E]">B</span>acl<span class="relative inline-block">i<span class="absolute top-0 right-0 h-3 w-3 rounded-full bg-[#CD7F32] translate-y-[7px] -translate-x-[3px] shadow-[0_0_7px_2px_#93c5fd]"></span></span>ght
</div>
</div>
</div>