Compare commits
10 Commits
13b00749fa
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 4fac3b1036 | |||
| 0464ba8929 | |||
| 78ce415b94 | |||
| 3fbece7da6 | |||
| d48bb96791 | |||
| 2beed66429 | |||
| 85f4dcc7ec | |||
| 1eb32f0fab | |||
| b5d0aa0bcd | |||
| 0ddd7d96ad |
@@ -72,3 +72,8 @@ yarn-debug.log*
|
||||
/config/master.key
|
||||
|
||||
.DS_Store
|
||||
|
||||
/app/assets/builds/*
|
||||
!/app/assets/builds/.keep
|
||||
|
||||
/mssql-data
|
||||
+1
-1
@@ -7,7 +7,7 @@ inherit_gem:
|
||||
rubocop-rails-omakase: rubocop.yml
|
||||
|
||||
AllCops:
|
||||
TargetRubyVersion: 3.4.2
|
||||
TargetRubyVersion: 3.3.9
|
||||
TargetRailsVersion: 7.2.2
|
||||
DisabledByDefault: true
|
||||
Exclude:
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
3.4.5
|
||||
3.3.9
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
# docker run -d -p 80:80 -p 443:443 --name my-app -e RAILS_MASTER_KEY=<value from config/master.key> my-app
|
||||
|
||||
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
|
||||
ARG RUBY_VERSION=3.4.5
|
||||
ARG RUBY_VERSION=3.3.9
|
||||
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
|
||||
|
||||
# Rails app lives here
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM mcr.microsoft.com/mssql/server:2017-latest
|
||||
ENV ACCEPT_EULA=Y
|
||||
ENV MSSQL_SA_PASSWORD=Br1tt0nPassw0rd
|
||||
ENV MSSQL_PID=Developer
|
||||
|
||||
COPY init.sql .
|
||||
COPY ./bin/dbentrypoint.sh .
|
||||
EXPOSE 1434
|
||||
CMD /bin/bash dbentrypoint.sh
|
||||
@@ -3,7 +3,7 @@
|
||||
source "https://rubygems.org"
|
||||
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
||||
|
||||
ruby "3.4.5"
|
||||
ruby "3.3.9"
|
||||
|
||||
# Bundle edge Rails instead:
|
||||
# gem "rails", github: "rails/rails", branch: "7-2-stable"
|
||||
@@ -12,9 +12,6 @@ gem "rails", "~> 7.2"
|
||||
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
|
||||
gem "sprockets-rails"
|
||||
|
||||
# Use postgresql as the database for Active Record
|
||||
gem "pg", "~> 1.5"
|
||||
|
||||
# Use the Puma web server [https://github.com/puma/puma]
|
||||
gem "puma", "~> 6.5"
|
||||
|
||||
@@ -31,7 +28,7 @@ gem "stimulus-rails"
|
||||
gem "jbuilder"
|
||||
|
||||
# Use Redis adapter to run Action Cable in production
|
||||
gem "redis", "~> 5.3"
|
||||
# gem "redis", "~> 5.3"
|
||||
|
||||
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
|
||||
# gem "kredis"
|
||||
@@ -40,17 +37,17 @@ gem "redis", "~> 5.3"
|
||||
# gem "bcrypt", "~> 3.1.7"
|
||||
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
gem "tzinfo-data", platforms: %i[ windows jruby ]
|
||||
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
|
||||
|
||||
# Reduces boot times through caching; required in config/boot.rb
|
||||
gem "bootsnap", require: false
|
||||
|
||||
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
||||
gem "image_processing", "~> 1.2"
|
||||
# gem "image_processing", "~> 1.2"
|
||||
|
||||
group :development, :test do
|
||||
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
||||
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
|
||||
# gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
|
||||
|
||||
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
|
||||
gem "brakeman", require: false
|
||||
@@ -70,6 +67,8 @@ group :development do
|
||||
|
||||
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
|
||||
gem "rack-mini-profiler"
|
||||
|
||||
gem "pry-rails"
|
||||
end
|
||||
|
||||
group :test do
|
||||
@@ -77,3 +76,15 @@ group :test do
|
||||
gem "capybara"
|
||||
gem "selenium-webdriver"
|
||||
end
|
||||
|
||||
gem 'activerecord-sqlserver-adapter'
|
||||
gem 'tiny_tds'
|
||||
gem 'devise'
|
||||
gem 'pundit'
|
||||
gem "tailwindcss-rails"
|
||||
gem 'docx'
|
||||
gem 'rubyzip'
|
||||
gem 'httparty'
|
||||
gem 'combine_pdf'
|
||||
gem 'rails_icons'
|
||||
gem 'fastimage'
|
||||
+211
-154
@@ -1,66 +1,71 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
actioncable (7.2.3)
|
||||
actionpack (= 7.2.3)
|
||||
activesupport (= 7.2.3)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
zeitwerk (~> 2.6)
|
||||
actionmailbox (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
activejob (= 7.2.2.2)
|
||||
activerecord (= 7.2.2.2)
|
||||
activestorage (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
actionmailbox (7.2.3)
|
||||
actionpack (= 7.2.3)
|
||||
activejob (= 7.2.3)
|
||||
activerecord (= 7.2.3)
|
||||
activestorage (= 7.2.3)
|
||||
activesupport (= 7.2.3)
|
||||
mail (>= 2.8.0)
|
||||
actionmailer (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
actionview (= 7.2.2.2)
|
||||
activejob (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
actionmailer (7.2.3)
|
||||
actionpack (= 7.2.3)
|
||||
actionview (= 7.2.3)
|
||||
activejob (= 7.2.3)
|
||||
activesupport (= 7.2.3)
|
||||
mail (>= 2.8.0)
|
||||
rails-dom-testing (~> 2.2)
|
||||
actionpack (7.2.2.2)
|
||||
actionview (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
actionpack (7.2.3)
|
||||
actionview (= 7.2.3)
|
||||
activesupport (= 7.2.3)
|
||||
cgi
|
||||
nokogiri (>= 1.8.5)
|
||||
racc
|
||||
rack (>= 2.2.4, < 3.2)
|
||||
rack (>= 2.2.4, < 3.3)
|
||||
rack-session (>= 1.0.1)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
useragent (~> 0.16)
|
||||
actiontext (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
activerecord (= 7.2.2.2)
|
||||
activestorage (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
actiontext (7.2.3)
|
||||
actionpack (= 7.2.3)
|
||||
activerecord (= 7.2.3)
|
||||
activestorage (= 7.2.3)
|
||||
activesupport (= 7.2.3)
|
||||
globalid (>= 0.6.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
actionview (7.2.3)
|
||||
activesupport (= 7.2.3)
|
||||
builder (~> 3.1)
|
||||
cgi
|
||||
erubi (~> 1.11)
|
||||
rails-dom-testing (~> 2.2)
|
||||
rails-html-sanitizer (~> 1.6)
|
||||
activejob (7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
activejob (7.2.3)
|
||||
activesupport (= 7.2.3)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
activerecord (7.2.2.2)
|
||||
activemodel (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
activemodel (7.2.3)
|
||||
activesupport (= 7.2.3)
|
||||
activerecord (7.2.3)
|
||||
activemodel (= 7.2.3)
|
||||
activesupport (= 7.2.3)
|
||||
timeout (>= 0.4.0)
|
||||
activestorage (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
activejob (= 7.2.2.2)
|
||||
activerecord (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
activerecord-sqlserver-adapter (7.2.8)
|
||||
activerecord (~> 7.2.0)
|
||||
tiny_tds
|
||||
activestorage (7.2.3)
|
||||
actionpack (= 7.2.3)
|
||||
activejob (= 7.2.3)
|
||||
activerecord (= 7.2.3)
|
||||
activesupport (= 7.2.3)
|
||||
marcel (~> 1.0)
|
||||
activesupport (7.2.2.2)
|
||||
activesupport (7.2.3)
|
||||
base64
|
||||
benchmark (>= 0.3)
|
||||
bigdecimal
|
||||
@@ -76,12 +81,13 @@ GEM
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
ast (2.4.3)
|
||||
base64 (0.3.0)
|
||||
benchmark (0.4.1)
|
||||
bigdecimal (3.2.2)
|
||||
bcrypt (3.1.20)
|
||||
benchmark (0.5.0)
|
||||
bigdecimal (3.3.1)
|
||||
bindex (0.8.1)
|
||||
bootsnap (1.18.6)
|
||||
msgpack (~> 1.2)
|
||||
brakeman (7.1.0)
|
||||
brakeman (7.1.1)
|
||||
racc
|
||||
builder (3.3.0)
|
||||
bundler-audit (0.9.2)
|
||||
@@ -96,64 +102,72 @@ GEM
|
||||
rack-test (>= 0.6.3)
|
||||
regexp_parser (>= 1.5, < 3.0)
|
||||
xpath (~> 3.2)
|
||||
cgi (0.5.0)
|
||||
coderay (1.1.3)
|
||||
combine_pdf (1.0.31)
|
||||
matrix
|
||||
ruby-rc4 (>= 0.1.5)
|
||||
concurrent-ruby (1.3.5)
|
||||
connection_pool (2.5.3)
|
||||
connection_pool (2.5.4)
|
||||
crass (1.0.6)
|
||||
date (3.4.1)
|
||||
debug (1.10.0)
|
||||
irb (~> 1.10)
|
||||
reline (>= 0.3.8)
|
||||
diff-lcs (1.6.0)
|
||||
csv (3.3.5)
|
||||
date (3.5.0)
|
||||
devise (4.9.4)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
diff-lcs (1.6.2)
|
||||
docx (0.10.0)
|
||||
nokogiri (~> 1.13, >= 1.13.0)
|
||||
rubyzip (>= 2.0, < 4)
|
||||
drb (2.2.3)
|
||||
erb (5.1.3)
|
||||
erubi (1.13.1)
|
||||
ffi (1.17.1-aarch64-linux-gnu)
|
||||
ffi (1.17.1-aarch64-linux-musl)
|
||||
ffi (1.17.1-arm-linux-gnu)
|
||||
ffi (1.17.1-arm-linux-musl)
|
||||
ffi (1.17.1-arm64-darwin)
|
||||
ffi (1.17.1-x86_64-darwin)
|
||||
ffi (1.17.1-x86_64-linux-gnu)
|
||||
ffi (1.17.1-x86_64-linux-musl)
|
||||
globalid (1.2.1)
|
||||
fastimage (2.4.0)
|
||||
globalid (1.3.0)
|
||||
activesupport (>= 6.1)
|
||||
httparty (0.23.2)
|
||||
csv
|
||||
mini_mime (>= 1.0.0)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (1.14.7)
|
||||
concurrent-ruby (~> 1.0)
|
||||
image_processing (1.14.0)
|
||||
mini_magick (>= 4.9.5, < 6)
|
||||
ruby-vips (>= 2.0.17, < 3)
|
||||
importmap-rails (2.1.0)
|
||||
importmap-rails (2.2.2)
|
||||
actionpack (>= 6.0.0)
|
||||
activesupport (>= 6.0.0)
|
||||
railties (>= 6.0.0)
|
||||
io-console (0.8.0)
|
||||
irb (1.15.1)
|
||||
io-console (0.8.1)
|
||||
irb (1.15.3)
|
||||
pp (>= 0.6.0)
|
||||
rdoc (>= 4.0.0)
|
||||
reline (>= 0.4.2)
|
||||
jbuilder (2.13.0)
|
||||
actionview (>= 5.0.0)
|
||||
activesupport (>= 5.0.0)
|
||||
json (2.13.2)
|
||||
jbuilder (2.14.1)
|
||||
actionview (>= 7.0.0)
|
||||
activesupport (>= 7.0.0)
|
||||
json (2.15.2)
|
||||
language_server-protocol (3.17.0.5)
|
||||
lint_roller (1.1.0)
|
||||
logger (1.7.0)
|
||||
loofah (2.24.1)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.12.0)
|
||||
mail (2.8.1)
|
||||
mail (2.9.0)
|
||||
logger
|
||||
mini_mime (>= 0.1.1)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
marcel (1.0.4)
|
||||
matrix (0.4.2)
|
||||
mini_magick (5.2.0)
|
||||
benchmark
|
||||
logger
|
||||
marcel (1.1.0)
|
||||
matrix (0.4.3)
|
||||
method_source (1.1.0)
|
||||
mini_mime (1.1.5)
|
||||
minitest (5.25.5)
|
||||
minitest (5.26.0)
|
||||
msgpack (1.8.0)
|
||||
net-imap (0.5.7)
|
||||
multi_xml (0.7.2)
|
||||
bigdecimal (~> 3.1)
|
||||
net-imap (0.5.12)
|
||||
date
|
||||
net-protocol
|
||||
net-pop (0.1.2)
|
||||
@@ -162,40 +176,47 @@ GEM
|
||||
timeout
|
||||
net-smtp (0.5.1)
|
||||
net-protocol
|
||||
nio4r (2.7.4)
|
||||
nokogiri (1.18.9-aarch64-linux-gnu)
|
||||
nio4r (2.7.5)
|
||||
nokogiri (1.18.10-aarch64-linux-gnu)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-aarch64-linux-musl)
|
||||
nokogiri (1.18.10-aarch64-linux-musl)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-arm-linux-gnu)
|
||||
nokogiri (1.18.10-arm-linux-gnu)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-arm-linux-musl)
|
||||
nokogiri (1.18.10-arm-linux-musl)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-arm64-darwin)
|
||||
nokogiri (1.18.10-arm64-darwin)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-x86_64-darwin)
|
||||
nokogiri (1.18.10-x86_64-darwin)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-x86_64-linux-gnu)
|
||||
nokogiri (1.18.10-x86_64-linux-gnu)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-x86_64-linux-musl)
|
||||
nokogiri (1.18.10-x86_64-linux-musl)
|
||||
racc (~> 1.4)
|
||||
orm_adapter (0.5.0)
|
||||
parallel (1.27.0)
|
||||
parser (3.3.9.0)
|
||||
parser (3.3.10.0)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
pg (1.5.9)
|
||||
pp (0.6.2)
|
||||
pp (0.6.3)
|
||||
prettyprint
|
||||
prettyprint (0.2.0)
|
||||
prism (1.4.0)
|
||||
psych (5.2.3)
|
||||
prism (1.6.0)
|
||||
pry (0.15.2)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
pry-rails (0.3.11)
|
||||
pry (>= 0.13.0)
|
||||
psych (5.2.6)
|
||||
date
|
||||
stringio
|
||||
public_suffix (6.0.1)
|
||||
public_suffix (6.0.2)
|
||||
puma (6.6.1)
|
||||
nio4r (~> 2.0)
|
||||
pundit (2.5.2)
|
||||
activesupport (>= 3.0.0)
|
||||
racc (1.8.1)
|
||||
rack (3.1.16)
|
||||
rack (3.2.4)
|
||||
rack-mini-profiler (4.0.1)
|
||||
rack (>= 1.2.0)
|
||||
rack-session (2.1.1)
|
||||
@@ -205,20 +226,20 @@ GEM
|
||||
rack (>= 1.3)
|
||||
rackup (2.2.1)
|
||||
rack (>= 3)
|
||||
rails (7.2.2.2)
|
||||
actioncable (= 7.2.2.2)
|
||||
actionmailbox (= 7.2.2.2)
|
||||
actionmailer (= 7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
actiontext (= 7.2.2.2)
|
||||
actionview (= 7.2.2.2)
|
||||
activejob (= 7.2.2.2)
|
||||
activemodel (= 7.2.2.2)
|
||||
activerecord (= 7.2.2.2)
|
||||
activestorage (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
rails (7.2.3)
|
||||
actioncable (= 7.2.3)
|
||||
actionmailbox (= 7.2.3)
|
||||
actionmailer (= 7.2.3)
|
||||
actionpack (= 7.2.3)
|
||||
actiontext (= 7.2.3)
|
||||
actionview (= 7.2.3)
|
||||
activejob (= 7.2.3)
|
||||
activemodel (= 7.2.3)
|
||||
activerecord (= 7.2.3)
|
||||
activestorage (= 7.2.3)
|
||||
activesupport (= 7.2.3)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 7.2.2.2)
|
||||
railties (= 7.2.3)
|
||||
rails-dom-testing (2.3.0)
|
||||
activesupport (>= 5.0.0)
|
||||
minitest
|
||||
@@ -226,44 +247,50 @@ GEM
|
||||
rails-html-sanitizer (1.6.2)
|
||||
loofah (~> 2.21)
|
||||
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
||||
railties (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
rails_icons (1.5.1)
|
||||
nokogiri (~> 1.16, >= 1.16.4)
|
||||
rails (>= 7.0)
|
||||
railties (7.2.3)
|
||||
actionpack (= 7.2.3)
|
||||
activesupport (= 7.2.3)
|
||||
cgi
|
||||
irb (~> 1.13)
|
||||
rackup (>= 1.0.0)
|
||||
rake (>= 12.2)
|
||||
thor (~> 1.0, >= 1.2.2)
|
||||
tsort (>= 0.2)
|
||||
zeitwerk (~> 2.6)
|
||||
rainbow (3.1.1)
|
||||
rake (13.2.1)
|
||||
rdoc (6.12.0)
|
||||
rake (13.3.1)
|
||||
rdoc (6.15.1)
|
||||
erb
|
||||
psych (>= 4.0.0)
|
||||
redis (5.4.1)
|
||||
redis-client (>= 0.22.0)
|
||||
redis-client (0.23.2)
|
||||
connection_pool
|
||||
regexp_parser (2.11.2)
|
||||
reline (0.6.0)
|
||||
tsort
|
||||
regexp_parser (2.11.3)
|
||||
reline (0.6.2)
|
||||
io-console (~> 0.5)
|
||||
rexml (3.4.1)
|
||||
rspec-core (3.13.3)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-expectations (3.13.3)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-mocks (3.13.2)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-rails (7.1.1)
|
||||
responders (3.2.0)
|
||||
actionpack (>= 7.0)
|
||||
activesupport (>= 7.0)
|
||||
railties (>= 7.0)
|
||||
rexml (3.4.4)
|
||||
rspec-core (3.13.6)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-expectations (3.13.5)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-mocks (3.13.7)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-rails (8.0.2)
|
||||
actionpack (>= 7.2)
|
||||
activesupport (>= 7.2)
|
||||
railties (>= 7.2)
|
||||
rspec-core (~> 3.13)
|
||||
rspec-expectations (~> 3.13)
|
||||
rspec-mocks (~> 3.13)
|
||||
rspec-support (~> 3.13)
|
||||
rspec-support (3.13.2)
|
||||
rubocop (1.79.2)
|
||||
rspec-support (3.13.6)
|
||||
rubocop (1.81.7)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
@@ -271,17 +298,17 @@ GEM
|
||||
parser (>= 3.3.0.2)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 2.9.3, < 3.0)
|
||||
rubocop-ast (>= 1.46.0, < 2.0)
|
||||
rubocop-ast (>= 1.47.1, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 4.0)
|
||||
rubocop-ast (1.46.0)
|
||||
rubocop-ast (1.47.1)
|
||||
parser (>= 3.3.7.2)
|
||||
prism (~> 1.4)
|
||||
rubocop-performance (1.24.0)
|
||||
rubocop-performance (1.26.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (>= 1.72.1, < 2.0)
|
||||
rubocop-ast (>= 1.38.0, < 2.0)
|
||||
rubocop-rails (2.33.3)
|
||||
rubocop (>= 1.75.0, < 2.0)
|
||||
rubocop-ast (>= 1.47.1, < 2.0)
|
||||
rubocop-rails (2.33.4)
|
||||
activesupport (>= 4.2.0)
|
||||
lint_roller (~> 1.1)
|
||||
rack (>= 1.1)
|
||||
@@ -291,23 +318,22 @@ GEM
|
||||
rubocop (>= 1.72)
|
||||
rubocop-performance (>= 1.24)
|
||||
rubocop-rails (>= 2.30)
|
||||
rubocop-rspec (3.6.0)
|
||||
rubocop-rspec (3.7.0)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
ruby-progressbar (1.13.0)
|
||||
ruby-vips (2.2.3)
|
||||
ffi (~> 1.12)
|
||||
logger
|
||||
rubyzip (2.4.1)
|
||||
ruby-rc4 (0.1.5)
|
||||
rubyzip (3.2.2)
|
||||
securerandom (0.4.1)
|
||||
selenium-webdriver (4.35.0)
|
||||
selenium-webdriver (4.38.0)
|
||||
base64 (~> 0.2)
|
||||
logger (~> 1.4)
|
||||
rexml (~> 3.2, >= 3.2.5)
|
||||
rubyzip (>= 1.2.2, < 4.0)
|
||||
websocket (~> 1.0)
|
||||
sprockets (4.2.1)
|
||||
sprockets (4.2.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
logger
|
||||
rack (>= 2.2.4, < 4)
|
||||
sprockets-rails (3.5.2)
|
||||
actionpack (>= 6.1)
|
||||
@@ -315,31 +341,54 @@ GEM
|
||||
sprockets (>= 3.0.0)
|
||||
stimulus-rails (1.3.4)
|
||||
railties (>= 6.0.0)
|
||||
stringio (3.1.5)
|
||||
stringio (3.1.7)
|
||||
tailwindcss-rails (4.4.0)
|
||||
railties (>= 7.0.0)
|
||||
tailwindcss-ruby (~> 4.0)
|
||||
tailwindcss-ruby (4.1.16)
|
||||
tailwindcss-ruby (4.1.16-aarch64-linux-gnu)
|
||||
tailwindcss-ruby (4.1.16-aarch64-linux-musl)
|
||||
tailwindcss-ruby (4.1.16-arm64-darwin)
|
||||
tailwindcss-ruby (4.1.16-x86_64-darwin)
|
||||
tailwindcss-ruby (4.1.16-x86_64-linux-gnu)
|
||||
tailwindcss-ruby (4.1.16-x86_64-linux-musl)
|
||||
thor (1.4.0)
|
||||
timeout (0.4.3)
|
||||
turbo-rails (2.0.13)
|
||||
timeout (0.4.4)
|
||||
tiny_tds (3.3.0)
|
||||
bigdecimal (~> 3)
|
||||
tiny_tds (3.3.0-aarch64-linux-gnu)
|
||||
bigdecimal (~> 3)
|
||||
tiny_tds (3.3.0-aarch64-linux-musl)
|
||||
bigdecimal (~> 3)
|
||||
tiny_tds (3.3.0-x86_64-linux-gnu)
|
||||
bigdecimal (~> 3)
|
||||
tiny_tds (3.3.0-x86_64-linux-musl)
|
||||
bigdecimal (~> 3)
|
||||
tsort (0.2.0)
|
||||
turbo-rails (2.0.20)
|
||||
actionpack (>= 7.1.0)
|
||||
railties (>= 7.1.0)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
unicode-display_width (3.1.4)
|
||||
unicode-emoji (~> 4.0, >= 4.0.4)
|
||||
unicode-emoji (4.0.4)
|
||||
unicode-display_width (3.2.0)
|
||||
unicode-emoji (~> 4.1)
|
||||
unicode-emoji (4.1.0)
|
||||
useragent (0.16.11)
|
||||
warden (1.2.9)
|
||||
rack (>= 2.0.9)
|
||||
web-console (4.2.1)
|
||||
actionview (>= 6.0.0)
|
||||
activemodel (>= 6.0.0)
|
||||
bindex (>= 0.4.0)
|
||||
railties (>= 6.0.0)
|
||||
websocket (1.2.11)
|
||||
websocket-driver (0.7.7)
|
||||
websocket-driver (0.8.0)
|
||||
base64
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
zeitwerk (2.7.2)
|
||||
zeitwerk (2.7.3)
|
||||
|
||||
PLATFORMS
|
||||
aarch64-linux-gnu
|
||||
@@ -352,32 +401,40 @@ PLATFORMS
|
||||
x86_64-linux-musl
|
||||
|
||||
DEPENDENCIES
|
||||
activerecord-sqlserver-adapter
|
||||
bootsnap
|
||||
brakeman
|
||||
bundler-audit
|
||||
capybara
|
||||
debug
|
||||
image_processing (~> 1.2)
|
||||
combine_pdf
|
||||
devise
|
||||
docx
|
||||
fastimage
|
||||
httparty
|
||||
importmap-rails
|
||||
jbuilder
|
||||
pg (~> 1.5)
|
||||
pry-rails
|
||||
puma (~> 6.5)
|
||||
pundit
|
||||
rack-mini-profiler
|
||||
rails (~> 7.2)
|
||||
redis (~> 5.3)
|
||||
rails_icons
|
||||
rspec-rails
|
||||
rubocop-rails
|
||||
rubocop-rails-omakase
|
||||
rubocop-rspec
|
||||
rubyzip
|
||||
selenium-webdriver
|
||||
sprockets-rails
|
||||
stimulus-rails
|
||||
tailwindcss-rails
|
||||
tiny_tds
|
||||
turbo-rails
|
||||
tzinfo-data
|
||||
web-console
|
||||
|
||||
RUBY VERSION
|
||||
ruby 3.4.5p51
|
||||
ruby 3.3.9p170
|
||||
|
||||
BUNDLED WITH
|
||||
2.6.5
|
||||
2.5.22
|
||||
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
web: bin/rails server -p 3000
|
||||
css: bin/rails dartsass:watch
|
||||
web: bin/rails server -b 0.0.0.0 -p 3002
|
||||
css: bin/rails tailwindcss:watch[verbose]
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
//= link_directory ../stylesheets .css
|
||||
//= link_tree ../../javascript .js
|
||||
//= link_tree ../../../vendor/javascript .js
|
||||
//= link_tree ../builds
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
@theme {
|
||||
/* dark blue */
|
||||
--color-deepcove: #04153E;
|
||||
/* medium dark blue */
|
||||
--color-bluetang: #2A4B6F;
|
||||
/* medium dark blue */
|
||||
--color-bluetang-tinted: #223C59;
|
||||
/* bright blue */
|
||||
--color-atmosphere: #0096E0;
|
||||
/* bright blue */
|
||||
--color-atmosphere-tinted: #007AB8;
|
||||
/* light blue */
|
||||
--color-bluemana: #6AC8F1;
|
||||
/* light blue */
|
||||
--color-bluemana-tinted: #44BBEE;
|
||||
/* cobalt blue */
|
||||
--color-cobalt: #0047AB;
|
||||
/* cobalt blue */
|
||||
--color-cobalt-tinted: #003B8F;
|
||||
/* platinum */
|
||||
--color-platinum: #E0E0E0;
|
||||
/* copper */
|
||||
--color-copper: #B06E30;
|
||||
/* copper */
|
||||
--color-copper-tinted: #905A27;
|
||||
/* bronze */
|
||||
--color-bronze: #D38F4A;
|
||||
/* bronze */
|
||||
--color-bronze-tinted: #C57A30;
|
||||
/* oxidized copper/bronze green-blue */
|
||||
--color-verdigris: #588288;
|
||||
/* oxidized copper/bronze green-blue */
|
||||
--color-verdigris-tinted: #496A6F;
|
||||
/* alert red */
|
||||
--color-brightlava: #f80800;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
class CardLogoFilesController < ApplicationController
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def image
|
||||
logo_file = CardLogoFile.find_by(filename: params[:id])
|
||||
puts params[:id]
|
||||
logo_binary = logo_file.image_data
|
||||
logo_filename = logo_file.filename
|
||||
logo_file_type = logo_file.content_type
|
||||
|
||||
send_data logo_binary,
|
||||
filename: logo_filename,
|
||||
# type: logo_file_type,
|
||||
disposition: 'inline'
|
||||
end
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
def create
|
||||
file = card_logo_file_params["logo_file"]
|
||||
if file.present? && file.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
filename = file.original_filename
|
||||
# binary_data = file.read
|
||||
binary_data = File.binread(file)
|
||||
meme_type = Marcel::MimeType.for(file)
|
||||
|
||||
CardLogoFile.create(
|
||||
filename: filename,
|
||||
image_data: binary_data,
|
||||
content_type: meme_type,
|
||||
logo_type: card_logo_file_params["logo_type"]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
end
|
||||
|
||||
def destroy
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def card_logo_file_params
|
||||
params.require(:card_logo_file).permit(:logo_file, :logo_type)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
class CardProvidersController < ApplicationController
|
||||
before_action :set_card_provider, only: %i[ show edit update destroy ]
|
||||
|
||||
# GET /card_providers or /card_providers.json
|
||||
def index
|
||||
@card_providers = CardProvider.all
|
||||
end
|
||||
|
||||
# GET /card_providers/1 or /card_providers/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /card_providers/new
|
||||
def new
|
||||
@card_provider = CardProvider.new
|
||||
end
|
||||
|
||||
# GET /card_providers/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /card_providers or /card_providers.json
|
||||
def create
|
||||
@card_provider = CardProvider.new(card_provider_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @card_provider.save
|
||||
format.html { redirect_to @card_provider, notice: "Card provider was successfully created." }
|
||||
format.json { render :show, status: :created, location: @card_provider }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.json { render json: @card_provider.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /card_providers/1 or /card_providers/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @card_provider.update(card_provider_params)
|
||||
format.html { redirect_to @card_provider, notice: "Card provider was successfully updated.", status: :see_other }
|
||||
format.json { render :show, status: :ok, location: @card_provider }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
format.json { render json: @card_provider.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /card_providers/1 or /card_providers/1.json
|
||||
def destroy
|
||||
@card_provider.destroy!
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to card_providers_path, notice: "Card provider was successfully destroyed.", status: :see_other }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_card_provider
|
||||
@card_provider = CardProvider.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def card_provider_params
|
||||
params.require(:card_provider).permit(:provider_code, :provider_line_1, :provider_line_2, :provider_line_3, :provider_line_4, :provider_line_5, :mail_to, :mail_to_2, :contact_line_1, :contact_line_2, :contact_line_3, :group_number, :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, :provider_line_6, :provider_line_7, :provider_line_8, :provider_line_9, :provider_line_10, :provider_line_11, :rx_group_id, :rx_contact, :provider_lookup_1, :provider_lookup_2, :precert_1, :precert_2, :precert_3, :precert_4, :precert_5, :precert_6, :provider_line_12, :claim_to_12)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
class CardRxesController < ApplicationController
|
||||
before_action :set_card_rx, only: %i[ show edit update destroy ]
|
||||
|
||||
# GET /card_rxes or /card_rxes.json
|
||||
def index
|
||||
@card_rxes = CardRx.all
|
||||
end
|
||||
|
||||
# GET /card_rxes/1 or /card_rxes/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /card_rxes/new
|
||||
def new
|
||||
@card_rx = CardRx.new
|
||||
end
|
||||
|
||||
# GET /card_rxes/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /card_rxes or /card_rxes.json
|
||||
def create
|
||||
@card_rx = CardRx.new(card_rx_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @card_rx.save
|
||||
format.html { redirect_to @card_rx, notice: "Card rx was successfully created." }
|
||||
format.json { render :show, status: :created, location: @card_rx }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.json { render json: @card_rx.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /card_rxes/1 or /card_rxes/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @card_rx.update(card_rx_params)
|
||||
format.html { redirect_to @card_rx, notice: "Card rx was successfully updated.", status: :see_other }
|
||||
format.json { render :show, status: :ok, location: @card_rx }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
format.json { render json: @card_rx.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /card_rxes/1 or /card_rxes/1.json
|
||||
def destroy
|
||||
@card_rx.destroy!
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to card_rxes_path, notice: "Card rx was successfully destroyed.", status: :see_other }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_card_rx
|
||||
@card_rx = CardRx.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def card_rx_params
|
||||
params.require(:card_rx).permit(:help_desk, :customer_service, :web_url)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,257 @@
|
||||
class EmployerSetupController < ApplicationController
|
||||
def index
|
||||
@employer_setups = EmployerSetupProcess.all
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
@employer_setup = EmployerSetupProcess.new
|
||||
@employer_setup.plans.build
|
||||
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
render :new
|
||||
end
|
||||
|
||||
def import
|
||||
word_doc = params[:employer_setup_process][:import_from_word]
|
||||
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
@employer_setup = BenefitsWordDocProcessor.new(word_doc.tempfile).call
|
||||
render :edit
|
||||
else
|
||||
@employer_setup = EmployerSetupProcess.new
|
||||
@employer_setup.plans.build
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
employer_setup_process_params = EmployerSetupProcess.permitted_params(params)
|
||||
puts "---Params---"
|
||||
puts employer_setup_process_params
|
||||
# post_image_processing_params = process_logos(employer_setup_process_params)
|
||||
@employer_setup = EmployerSetupProcess.new(employer_setup_process_params)
|
||||
if @employer_setup.save
|
||||
# update_logos_with_employer_setup_information()
|
||||
redirect_to @employer_setup, notice: 'Employer Setup Process initiated'
|
||||
else
|
||||
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@employer_setup = EmployerSetupProcess.find_by(slug: params[:id])
|
||||
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
render :edit
|
||||
# @resource = Resource.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@form = RegistrationForm.new(registration_params)
|
||||
|
||||
if params[:back_button]
|
||||
@form.current_step = @form.previous_step
|
||||
elsif params[:skip_newsletter]
|
||||
@form.current_step = @form.next_step # Skip newsletter step
|
||||
end
|
||||
|
||||
render :new
|
||||
end
|
||||
|
||||
def destroy
|
||||
# @resource = Resource.find(params[:id])
|
||||
# @resource.destroy
|
||||
# redirect_to resources_url, notice: 'Resource was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def process_logos(employer_setup_process_params)
|
||||
@uploaded_logos = []
|
||||
employer_logo = employer_setup_process_params["employer_logo"]
|
||||
if employer_logo.present? && employer_logo.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
filename = employer_logo.original_filename
|
||||
binary_data = employer_logo.read
|
||||
meme_type = Marcel::MimeType.for(employer_logo)
|
||||
|
||||
CardLogoFile.create(
|
||||
filename: filename,
|
||||
image_data: binary_data,
|
||||
content_type: meme_type,
|
||||
logo_type: "employer"
|
||||
)
|
||||
|
||||
@uploaded_logos.push(filename)
|
||||
employer_setup_process_params["employer_logo"] = filename
|
||||
end
|
||||
|
||||
network_logos = employer_setup_process_params["alternate_network_logos_attributes"]
|
||||
if network_logos.present?
|
||||
network_logos.each do |alt|
|
||||
|
||||
network_logo = alt.last["network_logo"]
|
||||
if network_logo.present? && network_logo.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
filename = network_logo.original_filename
|
||||
binary_data = network_logo.read
|
||||
meme_type = Marcel::MimeType.for(network_logo)
|
||||
|
||||
CardLogoFile.create(
|
||||
filename: filename,
|
||||
image_data: binary_data,
|
||||
content_type: meme_type,
|
||||
logo_type: "network"
|
||||
)
|
||||
|
||||
@uploaded_logos.push(filename)
|
||||
end
|
||||
alt.last["network_logo"] = @uploaded_logos.last
|
||||
end
|
||||
end
|
||||
employer_setup_process_params
|
||||
end
|
||||
|
||||
def update_logos_with_employer_setup_information()
|
||||
@uploaded_logos.each do |logo|
|
||||
logo_file = CardLogoFile.find_by(filename: logo)
|
||||
if logo_file.present? && @employer_setup.present?
|
||||
logo_file.employer_setup_process = @employer_setup
|
||||
logo_file.save
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# def general_information_params
|
||||
# params.require(:employer_setup_general_information_form).permit(
|
||||
# :name,
|
||||
# :employer_logo,
|
||||
# :group_number,
|
||||
# :dental,
|
||||
# :pl_plan_key,
|
||||
# :effect_date,
|
||||
# :number_of_plans,
|
||||
# :network,
|
||||
# :number_of_additional_network_logos
|
||||
# )
|
||||
# end
|
||||
|
||||
# def plans_params
|
||||
# params.require(:employer_setup_plans_form).permit(
|
||||
# plans: permited_plans_keys,
|
||||
# benefit_descs: benefit_sequence_keys
|
||||
# )
|
||||
# end
|
||||
|
||||
# def network_exceptions_params
|
||||
# params.require(:employer_setup_network_exceptions_form).permit(
|
||||
# network_exceptions: [:network_logo, exceptions: [:type, :value]],
|
||||
# )
|
||||
# end
|
||||
|
||||
def form_for_step
|
||||
step_name = @top_form.current_step
|
||||
form_method = "EmployerSetup#{step_name.camelize}Form".constantize
|
||||
# puts "/////\\\\\\||||||"
|
||||
# puts session[:employer_setup_data]
|
||||
# puts session[:employer_setup_data]['employer_setup_process_id']
|
||||
puts form_method
|
||||
form_method.new(session[:employer_setup_data]['employer_setup_process_id'])
|
||||
end
|
||||
|
||||
def process_step(step_name)
|
||||
@form_method = "EmployerSetup#{step_name.camelize}Form".constantize
|
||||
session_data_name = "#{step_name}_data"
|
||||
# puts "1--------------params----"
|
||||
# puts params
|
||||
# puts "8--------------session----"
|
||||
# puts session[:employer_setup_data]
|
||||
employer_setup_process_id = session[:employer_setup_data]['employer_setup_process_id']
|
||||
# puts session[:employer_setup_data]
|
||||
puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
puts params
|
||||
@form = @form_method.new(employer_setup_process_id, params)
|
||||
if @form.pl_plan_key.blank?
|
||||
@form.pl_plan_key = session[:employer_setup_data]['pl_plan_key']
|
||||
end
|
||||
if @form.valid? && @form.save
|
||||
pl_plan_key = @top_form.pl_plan_key || @form.pl_plan_key
|
||||
# session[:employer_setup_data].merge!({current_step: step_name, pl_plan_key: pl_plan_key})
|
||||
# form_fields = @form.attributes.merge!(global_params(step_name))
|
||||
# session[:employer_setup_data][session_data_name] = form_fields
|
||||
# session[:employer_setup_data].merge!(global_params(step_name))
|
||||
# puts session[:employer_setup_data][session_data_name]
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def step_params(step_name)
|
||||
form_name_sym = "employer_setup_#{step_name}_form".to_sym
|
||||
params.require(form_name_sym).permit(@form_method.permitted_params)
|
||||
end
|
||||
|
||||
def global_params(step_name)
|
||||
form_name_sym = "employer_setup_#{step_name}_form".to_sym
|
||||
params.require(form_name_sym).permit(EmployerSetupForm.permitted_params)
|
||||
end
|
||||
|
||||
# def process_step(step_name)
|
||||
# form_name = "employer_setup_#{step_name}_form".camelize.constantize
|
||||
# form_params_name = "#{step_name}_params".to_sym
|
||||
# allowed_params = [:general_information_params, :plans_params, :network_exceptions_params]
|
||||
# if allowed_params.include?(form_params_name)
|
||||
# form_params = send(form_params_name)
|
||||
# @form = form_name.new(form_params)
|
||||
# if @form.valid?
|
||||
# session[:employer_setup_data]["#{step_name}_data"] = form_params
|
||||
# true
|
||||
# else
|
||||
# false
|
||||
# end
|
||||
# end
|
||||
# false
|
||||
# end
|
||||
|
||||
# def employer_setup_params
|
||||
# params.require(:employer_setup_form).permit(
|
||||
# :current_step,
|
||||
# :name,
|
||||
# :employer_logo,
|
||||
# :group_number,
|
||||
# :pl_plan_key,
|
||||
# :effect_date,
|
||||
# :number_of_plans,
|
||||
# :network,
|
||||
# :number_of_additional_network_logos,
|
||||
# network_exceptions: [:network_logo, exceptions: [:type, :value]],
|
||||
# plans: permited_plans_keys,
|
||||
# benefit_descs: benefit_sequence_keys
|
||||
# )
|
||||
# end
|
||||
|
||||
# def benefit_sequence_keys
|
||||
# (1..14).map { |i| i.to_s.to_sym }
|
||||
# end
|
||||
|
||||
# def permited_plans_keys
|
||||
# benefit_sequence_keys.push(:plan_id)
|
||||
# end
|
||||
|
||||
# def plans_params
|
||||
# plans_keys = params[:plans]&.keys || []
|
||||
|
||||
# plans_keys.each_with_object({}) do |key, hash|
|
||||
# if key == 'benefit_descs' || key.match?(/^plan_\d$/)
|
||||
# hash[key.to_sym] = permited_plan_param_list
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
# def permited_plan_param_list
|
||||
# (1..14).map { |i| i.to_s.to_sym }.push(:plan_id)
|
||||
# end
|
||||
end
|
||||
@@ -0,0 +1,244 @@
|
||||
class EmployerSetupController < ApplicationController
|
||||
def new
|
||||
# session.delete(:employer_setup_data)
|
||||
# session.clear()
|
||||
# puts "Start"
|
||||
# puts session[:employer_setup_data]
|
||||
if session[:employer_setup_data].blank?
|
||||
@process = EmployerSetupProcess.create(status: "form")
|
||||
session[:employer_setup_data] = { "employer_setup_process_id" => @process.id }
|
||||
|
||||
end
|
||||
puts "-S--------------------------------------"
|
||||
puts session[:employer_setup_data]
|
||||
# session[:employer_setup_data]['current_step'] = 'plans'
|
||||
|
||||
@top_form = EmployerSetupForm.new(session[:employer_setup_data])
|
||||
if @top_form.current_step != 'summary'
|
||||
@form = form_for_step
|
||||
else
|
||||
@form = @top_form
|
||||
end
|
||||
|
||||
# case @top_form.current_step
|
||||
# when 'general_information'
|
||||
# @form = EmployerSetupGeneralInformationForm.new(session[:employer_setup_data]&.dig('general_information_data'))
|
||||
# when 'plans'
|
||||
# @form = EmployerSetupPlansForm.new(session[:employer_setup_data]&.dig('plans_data'))
|
||||
# when 'network_exceptions'
|
||||
# @form = EmployerSetupNetworkExceptionsForm.new(session[:employer_setup_data]&.dig('network_exceptions_data'))
|
||||
# when 'summary'
|
||||
# @form = @top_form
|
||||
# end
|
||||
render @top_form.current_step_view
|
||||
end
|
||||
|
||||
def create
|
||||
# puts session[:employer_setup_data]
|
||||
@top_form = EmployerSetupForm.new(session[:employer_setup_data])
|
||||
if @top_form.current_step != 'summary'
|
||||
if process_step(@top_form.current_step)
|
||||
session[:employer_setup_data]['current_step'] = @top_form.next_step
|
||||
puts "---------------------------------------"
|
||||
puts "pass"
|
||||
puts "next - #{@top_form.next_step}"
|
||||
puts session[:employer_setup_data]
|
||||
puts "---------------------------------------"
|
||||
redirect_to new_employer_setup_path
|
||||
else
|
||||
puts "fail"
|
||||
render @top_form.current_step_view
|
||||
end
|
||||
else
|
||||
if @top_form.save
|
||||
session.delete(:employer_setup_data)
|
||||
redirect_to root_path, notice: "Employer setup successfully!"
|
||||
else
|
||||
render @top_form.current_step_view
|
||||
end
|
||||
end
|
||||
|
||||
# case @top_form.current_step
|
||||
# when 'general_information'
|
||||
# @form = EmployerSetupGeneralInformationForm.new(general_information_params)
|
||||
# if @form.valid?
|
||||
# session[:employer_setup_data]['general_information_data'] = general_information_params
|
||||
# session[:employer_setup_data]['current_step'] = @top_form.next_step
|
||||
# redirect_to new_employer_setup_path
|
||||
# else
|
||||
# render @top_form.current_step_view
|
||||
# end
|
||||
# when 'plans'
|
||||
# @form = EmployerSetupPlansForm.new(plans_params)
|
||||
# if @form.valid?
|
||||
# session[:employer_setup_data]['plans_data'] = plans_params
|
||||
# session[:employer_setup_data]['current_step'] = @top_form.next_step
|
||||
# redirect_to new_employer_setup_path
|
||||
# else
|
||||
# render @top_form.current_step_view
|
||||
# end
|
||||
# when 'network_exceptions'
|
||||
# @form = EmployerSetupNetworkExceptionsForm.new(network_exceptions_params)
|
||||
# if @form.valid?
|
||||
# session[:employer_setup_data]['network_exceptions_data'] = network_exceptions_params
|
||||
# session[:employer_setup_data]['current_step'] = @top_form.next_step
|
||||
# redirect_to new_employer_setup_path
|
||||
# else
|
||||
# render @top_form.current_step_view
|
||||
# end
|
||||
# when 'summary'
|
||||
# @form = EmployerSetupForm.new(session[:employer_setup_data])
|
||||
# if @form.save
|
||||
# session.delete(:employer_setup_data)
|
||||
# redirect_to root_path, notice: "Employer setup successfully!"
|
||||
# else
|
||||
# render @top_form.current_step_view
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def update
|
||||
@form = RegistrationForm.new(registration_params)
|
||||
|
||||
if params[:back_button]
|
||||
@form.current_step = @form.previous_step
|
||||
elsif params[:skip_newsletter]
|
||||
@form.current_step = @form.next_step # Skip newsletter step
|
||||
end
|
||||
|
||||
render :new
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# def general_information_params
|
||||
# params.require(:employer_setup_general_information_form).permit(
|
||||
# :name,
|
||||
# :employer_logo,
|
||||
# :group_number,
|
||||
# :dental,
|
||||
# :pl_plan_key,
|
||||
# :effect_date,
|
||||
# :number_of_plans,
|
||||
# :network,
|
||||
# :number_of_additional_network_logos
|
||||
# )
|
||||
# end
|
||||
|
||||
# def plans_params
|
||||
# params.require(:employer_setup_plans_form).permit(
|
||||
# plans: permited_plans_keys,
|
||||
# benefit_descs: benefit_sequence_keys
|
||||
# )
|
||||
# end
|
||||
|
||||
# def network_exceptions_params
|
||||
# params.require(:employer_setup_network_exceptions_form).permit(
|
||||
# network_exceptions: [:network_logo, exceptions: [:type, :value]],
|
||||
# )
|
||||
# end
|
||||
|
||||
def form_for_step
|
||||
step_name = @top_form.current_step
|
||||
form_method = "EmployerSetup#{step_name.camelize}Form".constantize
|
||||
# puts "/////\\\\\\||||||"
|
||||
# puts session[:employer_setup_data]
|
||||
# puts session[:employer_setup_data]['employer_setup_process_id']
|
||||
puts form_method
|
||||
form_method.new(session[:employer_setup_data]['employer_setup_process_id'])
|
||||
end
|
||||
|
||||
def process_step(step_name)
|
||||
@form_method = "EmployerSetup#{step_name.camelize}Form".constantize
|
||||
session_data_name = "#{step_name}_data"
|
||||
# puts "1--------------params----"
|
||||
# puts params
|
||||
# puts "8--------------session----"
|
||||
# puts session[:employer_setup_data]
|
||||
employer_setup_process_id = session[:employer_setup_data]['employer_setup_process_id']
|
||||
# puts session[:employer_setup_data]
|
||||
puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
puts params
|
||||
@form = @form_method.new(employer_setup_process_id, params)
|
||||
if @form.pl_plan_key.blank?
|
||||
@form.pl_plan_key = session[:employer_setup_data]['pl_plan_key']
|
||||
end
|
||||
if @form.valid? && @form.save
|
||||
pl_plan_key = @top_form.pl_plan_key || @form.pl_plan_key
|
||||
# session[:employer_setup_data].merge!({current_step: step_name, pl_plan_key: pl_plan_key})
|
||||
# form_fields = @form.attributes.merge!(global_params(step_name))
|
||||
# session[:employer_setup_data][session_data_name] = form_fields
|
||||
# session[:employer_setup_data].merge!(global_params(step_name))
|
||||
# puts session[:employer_setup_data][session_data_name]
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def step_params(step_name)
|
||||
form_name_sym = "employer_setup_#{step_name}_form".to_sym
|
||||
params.require(form_name_sym).permit(@form_method.permitted_params)
|
||||
end
|
||||
|
||||
def global_params(step_name)
|
||||
form_name_sym = "employer_setup_#{step_name}_form".to_sym
|
||||
params.require(form_name_sym).permit(EmployerSetupForm.permitted_params)
|
||||
end
|
||||
|
||||
# def process_step(step_name)
|
||||
# form_name = "employer_setup_#{step_name}_form".camelize.constantize
|
||||
# form_params_name = "#{step_name}_params".to_sym
|
||||
# allowed_params = [:general_information_params, :plans_params, :network_exceptions_params]
|
||||
# if allowed_params.include?(form_params_name)
|
||||
# form_params = send(form_params_name)
|
||||
# @form = form_name.new(form_params)
|
||||
# if @form.valid?
|
||||
# session[:employer_setup_data]["#{step_name}_data"] = form_params
|
||||
# true
|
||||
# else
|
||||
# false
|
||||
# end
|
||||
# end
|
||||
# false
|
||||
# end
|
||||
|
||||
# def employer_setup_params
|
||||
# params.require(:employer_setup_form).permit(
|
||||
# :current_step,
|
||||
# :name,
|
||||
# :employer_logo,
|
||||
# :group_number,
|
||||
# :pl_plan_key,
|
||||
# :effect_date,
|
||||
# :number_of_plans,
|
||||
# :network,
|
||||
# :number_of_additional_network_logos,
|
||||
# network_exceptions: [:network_logo, exceptions: [:type, :value]],
|
||||
# plans: permited_plans_keys,
|
||||
# benefit_descs: benefit_sequence_keys
|
||||
# )
|
||||
# end
|
||||
|
||||
# def benefit_sequence_keys
|
||||
# (1..14).map { |i| i.to_s.to_sym }
|
||||
# end
|
||||
|
||||
# def permited_plans_keys
|
||||
# benefit_sequence_keys.push(:plan_id)
|
||||
# end
|
||||
|
||||
# def plans_params
|
||||
# plans_keys = params[:plans]&.keys || []
|
||||
|
||||
# plans_keys.each_with_object({}) do |key, hash|
|
||||
# if key == 'benefit_descs' || key.match?(/^plan_\d$/)
|
||||
# hash[key.to_sym] = permited_plan_param_list
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
# def permited_plan_param_list
|
||||
# (1..14).map { |i| i.to_s.to_sym }.push(:plan_id)
|
||||
# end
|
||||
end
|
||||
@@ -0,0 +1,109 @@
|
||||
class EmployerSetupController < ApplicationController
|
||||
def new
|
||||
@employer_data = session[:employer_data] || {}
|
||||
# @id_card_templates = IdCardTemplate.where.not(title: "BLANK")
|
||||
# @id_card_template_benefits = IdCardTemplate.find_by(title: "BLANK").id_card_template_benefits.sort_by(&:sequence)
|
||||
end
|
||||
|
||||
def create_employer
|
||||
@employer_data = {employer: {}}
|
||||
@employer_data[:employer].merge!(params.require(:employer).permit(
|
||||
:name,
|
||||
:group_number,
|
||||
:pl_plan_key,
|
||||
:effective_date
|
||||
))
|
||||
@employer_data[:employer].merge!(params.permit(:number_of_plans))
|
||||
|
||||
session[:employer_data] = @employer_data
|
||||
puts session[:employer_data]
|
||||
redirect_to action: :plans
|
||||
end
|
||||
|
||||
def plans
|
||||
@employer_data = session[:employer_data] || {}
|
||||
@id_card_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
@id_card_template_benefits = IdCardBenefitsTemplate.find_by(title: "BLANK").id_card_benefits.sort_by(&:sequence)
|
||||
end
|
||||
|
||||
def create_plans
|
||||
@employer_data = session[:employer_data] || {}
|
||||
@employer_data.merge!(params.require(:plans).permit(plans_params))
|
||||
session[:employer_data] = @employer_data
|
||||
redirect_to action: :networks
|
||||
end
|
||||
|
||||
def networks
|
||||
@employer_data = session[:employer_data] || {}
|
||||
|
||||
end
|
||||
|
||||
def create_provider_networks
|
||||
@employer_data = session[:employer_data] || {}
|
||||
@employer_data.merge!(params.require(:plans).permit(plans_params))
|
||||
session[:employer_data] = @employer_data
|
||||
redirect_to action: :networks
|
||||
end
|
||||
|
||||
|
||||
def process_bad_name
|
||||
@final_data = session[:employer_data]
|
||||
|
||||
# Vhcs::HlPlanCode.create(
|
||||
# group_number: @final_data['employer']['name'],
|
||||
# medical_number: @final_data['employer']['group_number'],
|
||||
# dental_number: ' ',
|
||||
# plan_key: @final_data['employer']['pl_plan_key'],
|
||||
# effective_date: @final_data['employer']['effective_date']
|
||||
# )
|
||||
|
||||
# default = Vhcs::HLRXCrosRef.find_by(pl_plan_key: 52)
|
||||
|
||||
# Vhcs::HLRXCrosRef.create(
|
||||
# group_no: @final_data['employer']['group_number'],
|
||||
# rx_group_id: @final_data['employer']['group_number'],
|
||||
# help_desk: default.help_desk,
|
||||
# customer_service: default.customer_service,
|
||||
# web_url: default.web_url,
|
||||
# pl_plan_key: @final_data['employer']['pl_plan_key']
|
||||
# )
|
||||
|
||||
# plans_data = @final_data['plans']
|
||||
# benefit_descs = plans_data.delete('benefit_descs')
|
||||
|
||||
# plans_data.each do |key, value|
|
||||
# plan_id = value.delete('plan_id')
|
||||
# value.each do |key2, value2|
|
||||
# Vhcs::HLEgglestonCardBenefit.create(
|
||||
# plan_id: plan_id,
|
||||
# benefit_desc: benefit_descs[key2],
|
||||
# benefit: value2,
|
||||
# sequence: key2,
|
||||
# plan_key: @final_data['employer']['pl_plan_key']
|
||||
# )
|
||||
# end
|
||||
|
||||
# end
|
||||
|
||||
# Create or update your model with @final_data
|
||||
# Clear the session data after successful save
|
||||
session[:employer_data] = nil
|
||||
# Redirect to a success page
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def plans_params
|
||||
plans_keys = params[:plans]&.keys || []
|
||||
|
||||
plans_keys.each_with_object({}) do |key, hash|
|
||||
if key == 'benefit_descs' || key.match?(/^plan_\d$/)
|
||||
hash[key.to_sym] = permited_plan_param_list
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def permited_plan_param_list
|
||||
(1..14).map { |i| i.to_s.to_sym }.push(:plan_id)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,89 @@
|
||||
class EmployerSetupController < ApplicationController
|
||||
def new
|
||||
# session.delete(:employer_setup_data)
|
||||
@form = EmployerSetupForm.new(session[:employer_setup_data])
|
||||
if @form.current_step == "plans"
|
||||
@id_card_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
@id_card_template_benefits = IdCardBenefitsTemplate.find_by(title: "BLANK").id_card_benefits.sort_by(&:sequence)
|
||||
end
|
||||
puts session[:employer_setup_data]
|
||||
render "employer_setup/#{@form.current_step}" # Renders the view for the current step
|
||||
end
|
||||
|
||||
def create
|
||||
filtered_params = employer_setup_params.except(:validation_context)
|
||||
@form = EmployerSetupForm.new(filtered_params)
|
||||
|
||||
if @form.current_step == "general" && @form.valid?(:general_info)
|
||||
# @form.current_step = "plans"
|
||||
@form.current_step = "networks" # TESTING, Change Back
|
||||
session[:employer_setup_data] = @form.attributes.slice("current_step", "name", "employer_logo", "group_number", "pl_plan_key", "effect_date", "number_of_plans", "network", "number_of_additional_network_logos")
|
||||
redirect_to new_employer_setup_path # Redirect to the next step
|
||||
elsif @form.current_step == "plans" && @form.valid?(:plan_info)
|
||||
if @form.number_of_additional_network_logos == 0
|
||||
next_step = "summary"
|
||||
else
|
||||
next_step = "networks"
|
||||
end
|
||||
@form.current_step = next_step
|
||||
session[:employer_setup_data].merge!(@form.attributes.slice("current_step", "plans", "benefit_descs"))
|
||||
redirect_to new_employer_setup_path
|
||||
# @form = UserOnboardingForm.new(session[:employer_setup_data]) # Re-initialize with all data
|
||||
elsif @form.current_step == "networks" && @form.valid?(:network_info)
|
||||
@form.current_step = "summary"
|
||||
session[:employer_setup_data].merge!(@form.attributes.slice("current_step", "network_exceptions"))
|
||||
redirect_to new_employer_setup_path
|
||||
elsif @form.current_step == "summary"
|
||||
puts @form.attributes
|
||||
if @form.save
|
||||
session.delete(:employer_setup_data) # Clear session data after successful save
|
||||
redirect_to root_path, notice: "Employer setup successfully!"
|
||||
else
|
||||
render "employer_setup/summary" # Render step two again with errors
|
||||
end
|
||||
else
|
||||
render "employer_setup/#{@form.current_step}" # Render the current step again with errors
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def employer_setup_params
|
||||
params.require(:employer_setup_form).permit(
|
||||
:current_step,
|
||||
:name,
|
||||
:employer_logo,
|
||||
:group_number,
|
||||
:pl_plan_key,
|
||||
:effect_date,
|
||||
:number_of_plans,
|
||||
:network,
|
||||
:number_of_additional_network_logos,
|
||||
network_exceptions: [:network_logo, exceptions: [:type, :value]],
|
||||
plans: permited_plans_keys,
|
||||
benefit_descs: benefit_sequence_keys
|
||||
)
|
||||
end
|
||||
|
||||
def benefit_sequence_keys
|
||||
(1..14).map { |i| i.to_s.to_sym }
|
||||
end
|
||||
|
||||
def permited_plans_keys
|
||||
benefit_sequence_keys.push(:plan_id)
|
||||
end
|
||||
|
||||
def plans_params
|
||||
plans_keys = params[:plans]&.keys || []
|
||||
|
||||
plans_keys.each_with_object({}) do |key, hash|
|
||||
if key == 'benefit_descs' || key.match?(/^plan_\d$/)
|
||||
hash[key.to_sym] = permited_plan_param_list
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def permited_plan_param_list
|
||||
(1..14).map { |i| i.to_s.to_sym }.push(:plan_id)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,259 @@
|
||||
class EmployersController < ApplicationController
|
||||
def index
|
||||
@employers = Employer.all
|
||||
end
|
||||
|
||||
def show
|
||||
@employer = Employer.find_by(slug: params[:id])
|
||||
end
|
||||
|
||||
def new
|
||||
@employer = Employer.new
|
||||
@employer.build_plan_with_default_benefits
|
||||
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
render :new
|
||||
end
|
||||
|
||||
def import
|
||||
word_doc = params[:employer][:import_from_word]
|
||||
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
@employer = BenefitsWordDocProcessor.new(word_doc.tempfile).call
|
||||
else
|
||||
@employer = Employer.new
|
||||
@employer.build_plan_with_default_benefits
|
||||
end
|
||||
render :new
|
||||
end
|
||||
|
||||
def create
|
||||
employer_params = Employer.permitted_params(params)
|
||||
puts "---Params---"
|
||||
puts employer_params
|
||||
# post_image_processing_params = process_logos(employer_setup_process_params)
|
||||
@employer = Employer.new(employer_params)
|
||||
if @employer.save
|
||||
# update_logos_with_employer_setup_information()
|
||||
redirect_to employer_path(@employer.slug), notice: 'Employer Saved'
|
||||
else
|
||||
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@employer = Employer.find_by(slug: params[:id])
|
||||
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
render :edit
|
||||
# @resource = Resource.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
employer_params = Employer.permitted_params(params)
|
||||
@employer = Employer.find(params[:id])
|
||||
|
||||
if @employer.update(employer_params)
|
||||
puts "sucess"
|
||||
redirect_to employer_path(@employer.slug), notice: 'Employer was successfully updated.'
|
||||
else
|
||||
puts "fail"
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def destroy
|
||||
# @resource = Resource.find(params[:id])
|
||||
# @resource.destroy
|
||||
# redirect_to resources_url, notice: 'Resource was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# def process_logos(employer_setup_process_params)
|
||||
# @uploaded_logos = []
|
||||
# employer_logo = employer_setup_process_params["employer_logo"]
|
||||
# if employer_logo.present? && employer_logo.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
# filename = employer_logo.original_filename
|
||||
# binary_data = employer_logo.read
|
||||
# meme_type = Marcel::MimeType.for(employer_logo)
|
||||
|
||||
# CardLogoFile.create(
|
||||
# filename: filename,
|
||||
# image_data: binary_data,
|
||||
# content_type: meme_type,
|
||||
# logo_type: "employer"
|
||||
# )
|
||||
|
||||
# @uploaded_logos.push(filename)
|
||||
# employer_setup_process_params["employer_logo"] = filename
|
||||
# end
|
||||
|
||||
# network_logos = employer_setup_process_params["alternate_network_logos_attributes"]
|
||||
# if network_logos.present?
|
||||
# network_logos.each do |alt|
|
||||
|
||||
# network_logo = alt.last["network_logo"]
|
||||
# if network_logo.present? && network_logo.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
# filename = network_logo.original_filename
|
||||
# binary_data = network_logo.read
|
||||
# meme_type = Marcel::MimeType.for(network_logo)
|
||||
|
||||
# CardLogoFile.create(
|
||||
# filename: filename,
|
||||
# image_data: binary_data,
|
||||
# content_type: meme_type,
|
||||
# logo_type: "network"
|
||||
# )
|
||||
|
||||
# @uploaded_logos.push(filename)
|
||||
# end
|
||||
# alt.last["network_logo"] = @uploaded_logos.last
|
||||
# end
|
||||
# end
|
||||
# employer_setup_process_params
|
||||
# end
|
||||
|
||||
# def update_logos_with_employer_setup_information()
|
||||
# @uploaded_logos.each do |logo|
|
||||
# logo_file = CardLogoFile.find_by(filename: logo)
|
||||
# if logo_file.present? && @employer.present?
|
||||
# logo_file.employer_setup_process = @employer
|
||||
# logo_file.save
|
||||
# end
|
||||
# end
|
||||
|
||||
# end
|
||||
|
||||
# def general_information_params
|
||||
# params.require(:employer_setup_general_information_form).permit(
|
||||
# :name,
|
||||
# :employer_logo,
|
||||
# :group_number,
|
||||
# :dental,
|
||||
# :pl_plan_key,
|
||||
# :effect_date,
|
||||
# :number_of_plans,
|
||||
# :network,
|
||||
# :number_of_additional_network_logos
|
||||
# )
|
||||
# end
|
||||
|
||||
# def plans_params
|
||||
# params.require(:employer_setup_plans_form).permit(
|
||||
# plans: permited_plans_keys,
|
||||
# benefit_descs: benefit_sequence_keys
|
||||
# )
|
||||
# end
|
||||
|
||||
# def network_exceptions_params
|
||||
# params.require(:employer_setup_network_exceptions_form).permit(
|
||||
# network_exceptions: [:network_logo, exceptions: [:type, :value]],
|
||||
# )
|
||||
# end
|
||||
|
||||
# def form_for_step
|
||||
# step_name = @top_form.current_step
|
||||
# form_method = "EmployerSetup#{step_name.camelize}Form".constantize
|
||||
# # puts "/////\\\\\\||||||"
|
||||
# # puts session[:employer_setup_data]
|
||||
# # puts session[:employer_setup_data]['employer_setup_process_id']
|
||||
# puts form_method
|
||||
# form_method.new(session[:employer_setup_data]['employer_setup_process_id'])
|
||||
# end
|
||||
|
||||
# def process_step(step_name)
|
||||
# @form_method = "EmployerSetup#{step_name.camelize}Form".constantize
|
||||
# session_data_name = "#{step_name}_data"
|
||||
# # puts "1--------------params----"
|
||||
# # puts params
|
||||
# # puts "8--------------session----"
|
||||
# # puts session[:employer_setup_data]
|
||||
# employer_setup_process_id = session[:employer_setup_data]['employer_setup_process_id']
|
||||
# # puts session[:employer_setup_data]
|
||||
# puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
# puts params
|
||||
# @form = @form_method.new(employer_setup_process_id, params)
|
||||
# if @form.pl_plan_key.blank?
|
||||
# @form.pl_plan_key = session[:employer_setup_data]['pl_plan_key']
|
||||
# end
|
||||
# if @form.valid? && @form.save
|
||||
# pl_plan_key = @top_form.pl_plan_key || @form.pl_plan_key
|
||||
# # session[:employer_setup_data].merge!({current_step: step_name, pl_plan_key: pl_plan_key})
|
||||
# # form_fields = @form.attributes.merge!(global_params(step_name))
|
||||
# # session[:employer_setup_data][session_data_name] = form_fields
|
||||
# # session[:employer_setup_data].merge!(global_params(step_name))
|
||||
# # puts session[:employer_setup_data][session_data_name]
|
||||
# true
|
||||
# else
|
||||
# false
|
||||
# end
|
||||
# end
|
||||
|
||||
# def step_params(step_name)
|
||||
# form_name_sym = "employer_setup_#{step_name}_form".to_sym
|
||||
# params.require(form_name_sym).permit(@form_method.permitted_params)
|
||||
# end
|
||||
|
||||
# def global_params(step_name)
|
||||
# form_name_sym = "employer_setup_#{step_name}_form".to_sym
|
||||
# params.require(form_name_sym).permit(EmployerSetupForm.permitted_params)
|
||||
# end
|
||||
|
||||
# def process_step(step_name)
|
||||
# form_name = "employer_setup_#{step_name}_form".camelize.constantize
|
||||
# form_params_name = "#{step_name}_params".to_sym
|
||||
# allowed_params = [:general_information_params, :plans_params, :network_exceptions_params]
|
||||
# if allowed_params.include?(form_params_name)
|
||||
# form_params = send(form_params_name)
|
||||
# @form = form_name.new(form_params)
|
||||
# if @form.valid?
|
||||
# session[:employer_setup_data]["#{step_name}_data"] = form_params
|
||||
# true
|
||||
# else
|
||||
# false
|
||||
# end
|
||||
# end
|
||||
# false
|
||||
# end
|
||||
|
||||
# def employer_setup_params
|
||||
# params.require(:employer_setup_form).permit(
|
||||
# :current_step,
|
||||
# :name,
|
||||
# :employer_logo,
|
||||
# :group_number,
|
||||
# :pl_plan_key,
|
||||
# :effect_date,
|
||||
# :number_of_plans,
|
||||
# :network,
|
||||
# :number_of_additional_network_logos,
|
||||
# network_exceptions: [:network_logo, exceptions: [:type, :value]],
|
||||
# plans: permited_plans_keys,
|
||||
# benefit_descs: benefit_sequence_keys
|
||||
# )
|
||||
# end
|
||||
|
||||
# def benefit_sequence_keys
|
||||
# (1..14).map { |i| i.to_s.to_sym }
|
||||
# end
|
||||
|
||||
# def permited_plans_keys
|
||||
# benefit_sequence_keys.push(:plan_id)
|
||||
# end
|
||||
|
||||
# def plans_params
|
||||
# plans_keys = params[:plans]&.keys || []
|
||||
|
||||
# plans_keys.each_with_object({}) do |key, hash|
|
||||
# if key == 'benefit_descs' || key.match?(/^plan_\d$/)
|
||||
# hash[key.to_sym] = permited_plan_param_list
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
# def permited_plan_param_list
|
||||
# (1..14).map { |i| i.to_s.to_sym }.push(:plan_id)
|
||||
# end
|
||||
end
|
||||
@@ -0,0 +1,89 @@
|
||||
class IdCardBenefitsTemplatesController < ApplicationController
|
||||
skip_before_action :verify_authenticity_token
|
||||
|
||||
def new_id_card_template
|
||||
@id_card_templates = IdCardTemplate.where.not(title: "BLANK")
|
||||
@id_card_template_benefits = IdCardTemplate.find_by(title: "BLANK").id_card_template_benefits.sort_by(&:sequence)
|
||||
end
|
||||
|
||||
def create_id_card_template
|
||||
@id_card_template = IdCardTemplate.create(title: params[:title])
|
||||
|
||||
params[:benefits].each do |key, value|
|
||||
IdCardTemplateBenefit.create(
|
||||
sequence: key,
|
||||
benefit_desc: value["desc"],
|
||||
benefit: value["value"],
|
||||
id_card_template: @id_card_template
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if @id_card_template.save && @id_card_template.id_card_template_benefits.length == 14
|
||||
format.html { redirect_to '/dev_tools/new_id_card_setup', notice: "Template was successfully created." }
|
||||
# format.json { render :show, status: :created, location: @employer }
|
||||
else
|
||||
format.html { render :new_id_card_template, status: :unprocessable_entity }
|
||||
# format.json { render json: @employer.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def new_id_card_setup
|
||||
@id_card_templates = IdCardTemplate.where.not(title: "BLANK")
|
||||
@id_card_template_benefits = IdCardTemplate.find_by(title: "BLANK").id_card_template_benefits
|
||||
end
|
||||
|
||||
def get_template_benefits
|
||||
@id_card_benefits = IdCardBenefitsTemplate.find(params[:id]).id_card_benefits
|
||||
render json: @id_card_benefits.as_json
|
||||
end
|
||||
|
||||
def create_id_card_setup
|
||||
employer_general = params['general']
|
||||
hl_plan_code = Vhcs::HlPlanCode.new(
|
||||
group_number: employer_general['group_number'],
|
||||
medical_number: employer_general['group_number'],
|
||||
dental_number: '',
|
||||
plan_key: employer_general['pl_plan_key'],
|
||||
effect_date: employer_general['effect_date']
|
||||
)
|
||||
|
||||
# Replace fairos_info with template like for benefits
|
||||
fairos_info = Vhcs::HLRXCrosRef.where(pl_plan_key: 52).first
|
||||
hlrx_cros_ref = Vhcs::HLRXCrosRef.new(
|
||||
group_no: employer_general['group_number'],
|
||||
rx_group_id: employer_general['group_number'],
|
||||
help_desk: fairos_info.help_desk,
|
||||
customer_service: fairos_info.customer_service,
|
||||
web_url: fairos_info.web_url,
|
||||
pl_plan_key: employer_general['pl_plan_key']
|
||||
)
|
||||
|
||||
number_of_plans = params[:number_of_plans].to_i
|
||||
|
||||
number_of_plans.each do |i|
|
||||
value['benefits'].each do |ben_key, ben_value|
|
||||
Vhcs::HLEgglestonCardBenefit.create(
|
||||
plan_id: value['plan_id'],
|
||||
benefit_desc: ben_value["desc"],
|
||||
benefit: ben_value["value"],
|
||||
sequence: ben_key,
|
||||
plan_key: employer_general['pl_plan_key']
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if hl_plan_code.save && hlrx_cros_ref.save
|
||||
format.html { redirect_to '/dev_tools/new_id_card_setup', notice: "Card setup was successfully created." }
|
||||
# format.json { render :show, status: :created, location: @employer }
|
||||
else
|
||||
format.html { render :new_id_card_setup, status: :unprocessable_entity }
|
||||
# format.json { render json: @employer.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,25 @@
|
||||
class SampleIdCardsController < ApplicationController
|
||||
|
||||
|
||||
def generate_sample
|
||||
@employer = Employer.find_by(slug: params[:employer_slug])
|
||||
sample_cards_pdf = SampleCardGenerator.new(@employer).call
|
||||
|
||||
send_data sample_cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_sample_cards_#{Date.today}.pdf",
|
||||
type: "application/pdf",
|
||||
disposition: 'attachment'
|
||||
|
||||
end
|
||||
|
||||
def generate_print
|
||||
@employer = Employer.find_by(slug: params[:employer_slug])
|
||||
sample_cards_pdf = EmployerCardsGenerator.new(@employer).call
|
||||
|
||||
send_data sample_cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_print_cards_#{Date.today}.pdf",
|
||||
type: "application/pdf",
|
||||
disposition: 'attachment'
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,112 @@
|
||||
class TailwindFormBuilder < ActionView::Helpers::FormBuilder
|
||||
class_attribute :text_field_helpers, default: field_helpers - [:label, :check_box, :radio_button, :fields_for, :fields, :hidden_field, :file_field]
|
||||
# leans on the FormBuilder class_attribute `field_helpers`
|
||||
# you'll want to add a method for each of the specific helpers listed here if you want to style them
|
||||
|
||||
TEXT_FIELD_STYLE = "bg-gray-200 rounded py-2 px-4 text-bluetang font-semibold leading-tight focus:outline-none focus:bg-white".freeze
|
||||
SELECT_FIELD_STYLE = "block bg-gray-200 text-gray-700 py-2 px-4 rounded leading-tight focus:outline-none focus:bg-white".freeze
|
||||
SUBMIT_BUTTON_STYLE = "cursor-pointer shadow bg-bronze focus:shadow-outline focus:outline-none text-white font-bold py-2 px-4 rounded hover:bg-copper".freeze
|
||||
|
||||
text_field_helpers.each do |field_method|
|
||||
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
|
||||
def #{field_method}(method, options = {})
|
||||
if options.delete(:tailwindified)
|
||||
super
|
||||
else
|
||||
text_like_field(#{field_method.inspect}, method, options)
|
||||
end
|
||||
end
|
||||
RUBY_EVAL
|
||||
end
|
||||
|
||||
def submit(value = nil, options = {})
|
||||
custom_opts, opts = partition_custom_opts(options)
|
||||
classes = apply_style_classes(SUBMIT_BUTTON_STYLE, custom_opts)
|
||||
|
||||
super(value, {class: classes}.merge(opts))
|
||||
end
|
||||
|
||||
def select(method, choices = nil, options = {}, html_options = {}, &block)
|
||||
custom_opts, opts = partition_custom_opts(options)
|
||||
classes = apply_style_classes(SELECT_FIELD_STYLE, custom_opts, method)
|
||||
|
||||
labels = labels(method, custom_opts[:label], options)
|
||||
field = super(method, choices, opts, html_options.merge({class: classes}), &block)
|
||||
|
||||
labels + field
|
||||
end
|
||||
|
||||
def file_field(method, options = {})
|
||||
options[:class] = Array(options[:class]) << "block w-full px-1 py-[1px] text-sm text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 dark:text-gray-400 focus:outline-none dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100"
|
||||
# You can add more classes as needed for padding, margin, etc., e.g., p-2.5
|
||||
super(method, options)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def text_like_field(field_method, object_method, options = {})
|
||||
custom_opts, opts = partition_custom_opts(options)
|
||||
|
||||
classes = apply_style_classes(TEXT_FIELD_STYLE, custom_opts, object_method)
|
||||
|
||||
field = send(field_method, object_method, {
|
||||
class: classes,
|
||||
title: errors_for(object_method)&.join(" ")
|
||||
}.compact.merge(opts).merge({tailwindified: true}))
|
||||
|
||||
labels = labels(object_method, custom_opts[:label], options)
|
||||
|
||||
labels + field
|
||||
end
|
||||
|
||||
def labels(object_method, label_options, field_options)
|
||||
label = tailwind_label(object_method, label_options, field_options)
|
||||
error_label = error_label(object_method, field_options)
|
||||
|
||||
@template.content_tag("div", label + error_label, {class: "flex flex-col items-start"})
|
||||
end
|
||||
|
||||
def tailwind_label(object_method, label_options, field_options)
|
||||
text, label_opts = if label_options.present?
|
||||
[label_options[:text], label_options.except(:text)]
|
||||
else
|
||||
[nil, {}]
|
||||
end
|
||||
|
||||
label_classes = label_opts[:class] || "block text-platinum font-bold md:text-right mb-1 md:mb-0 pr-4"
|
||||
label_classes += " text-yellow-800 dark:text-yellow-400" if field_options[:disabled]
|
||||
label(object_method, text, {
|
||||
class: label_classes
|
||||
}.merge(label_opts.except(:class)))
|
||||
end
|
||||
|
||||
def error_label(object_method, options)
|
||||
if errors_for(object_method).present?
|
||||
error_message = @object.errors[object_method].collect(&:titleize).join(", ")
|
||||
tailwind_label(object_method, {text: error_message, class: " font-bold text-red-500"}, options)
|
||||
end
|
||||
end
|
||||
|
||||
def border_color_classes(object_method)
|
||||
if errors_for(object_method).present?
|
||||
" border-2 border-red-400 focus:border-rose-200"
|
||||
else
|
||||
" border border-platinum focus:border-yellow-700"
|
||||
end
|
||||
end
|
||||
|
||||
def apply_style_classes(classes, custom_opts, object_method = nil)
|
||||
classes + border_color_classes(object_method) + " #{custom_opts[:class]}"
|
||||
end
|
||||
|
||||
CUSTOM_OPTS = [:label, :class].freeze
|
||||
def partition_custom_opts(opts)
|
||||
opts.partition { |k, v| CUSTOM_OPTS.include?(k) }.map(&:to_h)
|
||||
end
|
||||
|
||||
def errors_for(object_method)
|
||||
return unless @object.present? && object_method.present?
|
||||
|
||||
@object.errors[object_method]
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,85 @@
|
||||
class EmployerSetupForm
|
||||
include ActiveModel::Model
|
||||
include ActiveModel::Attributes
|
||||
|
||||
FIRST_STEP = "general_information"
|
||||
|
||||
attribute :current_step, :string, default: FIRST_STEP
|
||||
attribute :pl_plan_key, :string
|
||||
attribute :employer_setup_process_id, :integer
|
||||
|
||||
def initialize(params = {})
|
||||
# if params.present?
|
||||
# params = permitted_params(params)
|
||||
# end
|
||||
# @current_step = params["current_step"]
|
||||
# @employer_setup_process_id = params["employer_setup_process_id"]
|
||||
super(params)
|
||||
|
||||
unless self.steps.first == FIRST_STEP
|
||||
raise StepMisalignmentError, "FIRST_STEP does not match first entry in steps"
|
||||
end
|
||||
# @general_information_data = EmployerSetupGeneralInformationForm.new(attributes[:general_information_data])
|
||||
# @plans_data = EmployerSetupPlansForm.new(attributes[:plans_data])
|
||||
# @network_exceptions_data = EmployerSetupNetworkExceptionsForm.new(attributes[:network_exceptions_data])
|
||||
end
|
||||
|
||||
# def self.form_session_init
|
||||
# {
|
||||
# general_information_data: {},
|
||||
# plans_data: {},
|
||||
# network_exceptions_data: {}
|
||||
# }
|
||||
# end
|
||||
|
||||
# def steps
|
||||
# %w[general_information plans network_exceptions summary]
|
||||
# end
|
||||
|
||||
def steps
|
||||
%w[general_information plans network_exceptions summary]
|
||||
end
|
||||
|
||||
def current_step_view
|
||||
"employer_setup/#{self.current_step}"
|
||||
end
|
||||
|
||||
def next_step
|
||||
index = steps.index(current_step)
|
||||
if index && index < steps.length - 1
|
||||
steps[index + 1]
|
||||
end
|
||||
end
|
||||
|
||||
def previous_step
|
||||
index = steps.index(current_step)
|
||||
steps[index - 1] if index && index > 0
|
||||
end
|
||||
|
||||
def permitted_params(params)
|
||||
params.permit(
|
||||
:pl_plan_key,
|
||||
:current_step
|
||||
)
|
||||
end
|
||||
|
||||
def self.permitted_params
|
||||
[
|
||||
:pl_plan_key,
|
||||
:current_step
|
||||
]
|
||||
end
|
||||
|
||||
def save
|
||||
if valid?
|
||||
process = EmployerSetupProcess.find(@employer_setup_process_id)
|
||||
process.update(
|
||||
status: "entered"
|
||||
)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,62 @@
|
||||
class EmployerSetupForm
|
||||
include ActiveModel::Model
|
||||
include ActiveModel::Attributes
|
||||
|
||||
attribute :current_step, :string, default: "general"
|
||||
attribute :name, :string
|
||||
attribute :employer_logo
|
||||
attribute :group_number, :string
|
||||
attribute :pl_plan_key, :string
|
||||
attribute :effect_date, :string
|
||||
attribute :number_of_plans, :integer
|
||||
attribute :network, :string
|
||||
attribute :number_of_additional_network_logos, :integer
|
||||
attribute :plans, array: true, default: -> { [] }
|
||||
# attribute :benefit_descs, :hash, default: -> { {} }
|
||||
attribute :network_exceptions, array: true, default: -> { [] }
|
||||
|
||||
attr_accessor :benefit_descs
|
||||
|
||||
# Define validations based on the current step
|
||||
with_options on: :general_info do
|
||||
validates :name, presence: true
|
||||
validates :employer_logo, presence: true
|
||||
validates :group_number, presence: true
|
||||
validates :pl_plan_key, presence: true
|
||||
validates :effect_date, presence: true
|
||||
validates :number_of_plans, presence: true
|
||||
validates :network, presence: true
|
||||
# validates :number_of_additional_network_logos, presence: true if network = "cigna+"
|
||||
end
|
||||
|
||||
with_options on: :plan_info do
|
||||
validates :plans, presence: true
|
||||
# validates :benefit_descs, presence: true
|
||||
end
|
||||
|
||||
with_options on: :network_info do
|
||||
# validates :network_exceptions, presence: true if number_of_additional_network_logos > 0
|
||||
end
|
||||
|
||||
# def initialize(params = {})
|
||||
# super(params)
|
||||
# # Ensure the attribute is a hash after initialization
|
||||
# @benefit_descs = params[:benefit_descs].to_h if params[:benefit_descs]
|
||||
# end
|
||||
|
||||
def benefit_descs
|
||||
@benefit_descs ||= {}
|
||||
end
|
||||
|
||||
def save
|
||||
# Implement logic to save data to models after all steps are complete
|
||||
# For example, create a User record with the collected data
|
||||
if valid? && step == total_steps
|
||||
# User.create!(name: name, email: email, password: password)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,130 @@
|
||||
class EmployerSetupGeneralInformationForm
|
||||
include ActiveModel::Model
|
||||
include ActiveModel::Attributes
|
||||
|
||||
attribute :name, :string
|
||||
attribute :employer_logo
|
||||
attribute :group_number, :string
|
||||
attribute :dental, :boolean, default: false
|
||||
attribute :pl_plan_key, :string
|
||||
attribute :effective_date, :string
|
||||
# attribute :number_of_plans, :integer
|
||||
attribute :network, :string
|
||||
# attribute :number_of_additional_network_logos, :integer
|
||||
|
||||
attr_accessor :employer_setup_process_id
|
||||
|
||||
validates :name, presence: true
|
||||
validates :employer_logo, presence: true
|
||||
validates :group_number, presence: true
|
||||
validates :effective_date, presence: true
|
||||
# validates :number_of_plans, presence: true
|
||||
validates :network, presence: true
|
||||
# validates :number_of_additional_network_logos, presence: true if network = "cigna+"
|
||||
|
||||
# def initialize(attributes = {})
|
||||
# if attributes
|
||||
# permitted_attributes = form_strong_params(attributes)
|
||||
# super(permitted_attributes)
|
||||
# end
|
||||
|
||||
def initialize(employer_setup_process_id, params = {})
|
||||
@employer_setup_process_id = employer_setup_process_id
|
||||
if params.present?
|
||||
form_params = permitted_params(params)
|
||||
super(form_params)
|
||||
else
|
||||
super(params)
|
||||
load_from_process
|
||||
end
|
||||
end
|
||||
|
||||
def load_from_process
|
||||
process = EmployerSetupProcess.find(@employer_setup_process_id)
|
||||
|
||||
self.name = process.employer_name
|
||||
# self.employer_logo = process.
|
||||
self.group_number = process.group_number
|
||||
self.dental = false
|
||||
self.pl_plan_key = process.pl_plan_key
|
||||
self.effective_date = process.effective_date
|
||||
self.network = process.network_provider
|
||||
end
|
||||
|
||||
def permitted_params(params)
|
||||
params.require(:employer_setup_general_information_form).permit(
|
||||
:name,
|
||||
:employer_logo,
|
||||
:group_number,
|
||||
:dental,
|
||||
:pl_plan_key,
|
||||
:effective_date,
|
||||
:number_of_plans,
|
||||
:network,
|
||||
:number_of_additional_network_logos
|
||||
)
|
||||
end
|
||||
|
||||
def save
|
||||
# Implement logic to save data to models after all steps are complete
|
||||
# For example, create a User record with the collected data
|
||||
if valid?
|
||||
process = EmployerSetupProcess.find(@employer_setup_process_id)
|
||||
process.update(
|
||||
employer_name: name,
|
||||
group_number: group_number,
|
||||
pl_plan_key: pl_plan_key,
|
||||
effective_date: effective_date,
|
||||
network_provider: network
|
||||
)
|
||||
|
||||
# hl_plan_code = Vhcs::HlPlanCode.create!(
|
||||
# group_number: group_number,
|
||||
# medical_number: group_number,
|
||||
# dental_number: '',
|
||||
# plan_key: pl_plan_key,
|
||||
# effect_date: effective_date
|
||||
# )
|
||||
|
||||
# # Replace fairos_info with template like for benefits
|
||||
# fairos_info = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first
|
||||
# hlrx_cros_ref = Vhcs::HlrxCrosRef.create!(
|
||||
# group_no: group_number,
|
||||
# rx_group_id: group_number,
|
||||
# help_desk: fairos_info.help_desk,
|
||||
# customer_service: fairos_info.customer_service,
|
||||
# web_url: fairos_info.web_url,
|
||||
# pl_plan_key: pl_plan_key
|
||||
# )
|
||||
|
||||
# web_employer = BrittonWeb::Employers.create!(
|
||||
# name: name,
|
||||
# pl_plan_key: pl_plan_key,
|
||||
# dental_plan: dental,
|
||||
# single_card_template: 'FairosRxIDCard',
|
||||
# logo: employer_logo.original_filename
|
||||
# )
|
||||
|
||||
# default_network_logo =
|
||||
# case
|
||||
# when network.include?("cig")
|
||||
# "CignaLogo.png"
|
||||
# when network.include?("med")
|
||||
# "Logo_MC_PMS.png"
|
||||
# else
|
||||
# "CignaLogo.png"
|
||||
# end
|
||||
|
||||
# BrittonWeb::NetworkLogos.create!(
|
||||
# employer_id: web_employer.id,
|
||||
# net_logo: default_network_logo,
|
||||
# default: true
|
||||
# )
|
||||
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,107 @@
|
||||
class EmployerSetupNetworkExceptionsForm
|
||||
include ActiveModel::Model
|
||||
include ActiveModel::Attributes
|
||||
|
||||
Network_exception = Struct.new(:network_logo, :exceptions)
|
||||
attribute :network_exceptions, :array_of_items, default: -> { [] }
|
||||
attribute :pl_plan_key, :string
|
||||
|
||||
attr_accessor :employer_setup_process_id
|
||||
|
||||
# validates :network_exceptions, presence: true if number_of_additional_network_logos > 0
|
||||
|
||||
def initialize(employer_setup_process_id, params = {})
|
||||
@employer_setup_process_id = employer_setup_process_id
|
||||
if params.present?
|
||||
form_params = permitted_params(params)
|
||||
super(form_params)
|
||||
else
|
||||
super(params)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def permitted_params(params)
|
||||
params.require(:employer_setup_network_exceptions_form).permit(
|
||||
network_exceptions: [
|
||||
:network_logo,
|
||||
exceptions: [
|
||||
:type,
|
||||
:value
|
||||
]
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
# def self.permitted_params
|
||||
# [
|
||||
# network_exceptions: [
|
||||
# :network_logo,
|
||||
# exceptions: [
|
||||
# :type,
|
||||
# :value
|
||||
# ]
|
||||
# ]
|
||||
# ]
|
||||
# end
|
||||
|
||||
def pull_from_employer_setup_form(attributes = {})
|
||||
if attributes['pl_plan_key']
|
||||
self.pl_plan_key = attributes['pl_plan_key']
|
||||
end
|
||||
if attributes['number_of_additional_network_logos']
|
||||
self.number_of_additional_network_logos = attributes['number_of_additional_network_logos']
|
||||
end
|
||||
end
|
||||
|
||||
def process_for_save(network_exceptions)
|
||||
ne_array = []
|
||||
network_exceptions.first.each do |ne|
|
||||
processed_ne = ne.last
|
||||
exceptions_array = []
|
||||
processed_ne['exceptions'].each do |e|
|
||||
exceptions_array.push(e.last)
|
||||
end
|
||||
processed_ne['exceptions'] = exceptions_array
|
||||
ne_array.push(processed_ne)
|
||||
end
|
||||
ne_array
|
||||
end
|
||||
|
||||
def save
|
||||
# Implement logic to save data to models after all steps are complete
|
||||
# For example, create a User record with the collected data
|
||||
if valid?
|
||||
process = EmployerSetupProcess.find(@employer_setup_process_id)
|
||||
# employer = BrittonWeb::Employers.find_by(pl_plan_key: pl_plan_key)
|
||||
if network_exceptions
|
||||
network_exceptions_data = process_for_save(network_exceptions)
|
||||
end
|
||||
# network_exceptions_data.each do |ne|
|
||||
# ne['exceptions'].each do |ex|
|
||||
# BrittonWeb::NetworkLogos.create!(
|
||||
# employer_id: employer.id,
|
||||
# net_logo: ne['network_logo'].original_filename,
|
||||
# exception_type: ex['type'].downcase,
|
||||
# exception_value: ex['value'],
|
||||
# default: false
|
||||
# )
|
||||
# end
|
||||
# end
|
||||
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
class NetworkException
|
||||
include ActiveModel::Model
|
||||
include ActiveModel::Attributes
|
||||
|
||||
attribute :network_logo
|
||||
attribute :exceptions, array: true, default: -> { [] }
|
||||
end
|
||||
@@ -0,0 +1,186 @@
|
||||
class EmployerSetupPlansForm
|
||||
include ActiveModel::Model
|
||||
include ActiveModel::Attributes
|
||||
|
||||
PLAN_COLORS = ['atmosphere', 'verdigris', 'bluemana', 'cobalt']
|
||||
|
||||
attribute :plans, array: true, default: -> { [Plan.new] }
|
||||
attribute :pl_plan_key, :string
|
||||
attribute :benefit_descs, hash: true, default: -> { Plan.new }
|
||||
|
||||
attr_accessor :plan_templates
|
||||
attr_accessor :benefits_template
|
||||
attr_accessor :employer_setup_process_id
|
||||
|
||||
validates :plans, presence: true
|
||||
validates :benefit_descs, presence: true
|
||||
|
||||
def initialize(employer_setup_process_id, params = {})
|
||||
@employer_setup_process_id = employer_setup_process_id
|
||||
if params.present?
|
||||
form_params = permitted_params(params)
|
||||
super(form_params)
|
||||
else
|
||||
super(params)
|
||||
process_plans = EmployerSetupProcess.find(@employer_setup_process_id).plans
|
||||
if process_plans.present?
|
||||
self.plans = process_plans
|
||||
end
|
||||
end
|
||||
|
||||
@plan_templates = IdCardBenefitsTemplate.where.not(title: "BLANK")
|
||||
@benefits_template = IdCardBenefitsTemplate.find_by(title: "BLANK").id_card_benefits.sort_by(&:sequence)
|
||||
|
||||
# if attributes.present? && attributes[:plans].present?
|
||||
# self.plans = Array(attributes[:plans])
|
||||
# else
|
||||
# self.plans = [new_plan]
|
||||
# end
|
||||
end
|
||||
|
||||
# def plans_attributes=(attributes)
|
||||
# self.plans = attributes.values.map { |plan_attrs| Plan.new(plan_attrs) }
|
||||
# end
|
||||
|
||||
def persisted?
|
||||
false
|
||||
end
|
||||
|
||||
|
||||
# The core method to initialize the array with a single blank item.
|
||||
def ensure_one_plan_exists
|
||||
if plans.empty?
|
||||
self.plans << PlanForm.new
|
||||
self.plans << PlanForm.new
|
||||
end
|
||||
end
|
||||
|
||||
def bulild_descs_plan
|
||||
self.benefit_descs = IdCardBenefitsTemplate.find_by(title: "BLANK").id_card_benefits.sort_by(&:sequence)
|
||||
end
|
||||
|
||||
def self.new_plan
|
||||
plan = {}
|
||||
self.permited_plans_keys.each do |key|
|
||||
plan[key] = ""
|
||||
end
|
||||
plan
|
||||
end
|
||||
|
||||
def process_params(employer_setup_process_id)
|
||||
process = EmployerSetupProcess.find(employer_setup_process_id)
|
||||
process.plans
|
||||
end
|
||||
|
||||
def permitted_params(params)
|
||||
params.require(:employer_setup_plans_form).permit(
|
||||
:pl_plan_key,
|
||||
plans: self.permited_plans_keys,
|
||||
benefit_descs: self.permited_plans_keys
|
||||
)
|
||||
end
|
||||
|
||||
def pull_from_employer_setup_form(attributes = {})
|
||||
if attributes['pl_plan_key']
|
||||
self.pl_plan_key = attributes['pl_plan_key']
|
||||
end
|
||||
if attributes['number_of_plans']
|
||||
self.number_of_plans = attributes['number_of_plans']
|
||||
end
|
||||
end
|
||||
|
||||
# def form_strong_params(attributes)
|
||||
# attributes.require(:employer_setup_plans_form).permit(
|
||||
# plans: permited_plans_keys,
|
||||
# benefit_descs: benefit_sequence_keys
|
||||
# )
|
||||
# end
|
||||
|
||||
def self.permited_plans_keys
|
||||
(1..14).map { |i| "benefit_#{i}".to_sym }.push(:plan_id)
|
||||
end
|
||||
|
||||
def permited_plans_keys
|
||||
(1..14).map { |i| "benefit_#{i}".to_sym }.push(:plan_id, :id)
|
||||
end
|
||||
|
||||
def save
|
||||
# Implement logic to save data to models after all steps are complete
|
||||
# For example, create a User record with the collected data
|
||||
if valid?
|
||||
process = EmployerSetupProcess.find(@employer_setup_process_id)
|
||||
# process.plans.update(plans: plans)
|
||||
|
||||
planss = Array.wrap(plans)
|
||||
|
||||
plans.each_with_index do |plan, i|
|
||||
plan_info = plan.last
|
||||
plan_id = plan_info[:plan_id].present? ? plan_info[:plan_id].to_i : "temp #{i}"
|
||||
plan_info.delete(:plan_id)
|
||||
new_plan = process.plans.create(plan_id: plan_id)
|
||||
plan_info.each do |key, value|
|
||||
sequence = key.delete_prefix("benefit_").to_i
|
||||
benefit = new_plan.plan_benefits.find_by(sequence: sequence)
|
||||
benefit.update(
|
||||
benefit: value
|
||||
)
|
||||
# Vhcs::HlEgglestonCardBenefit.create(
|
||||
# plan_id: plan_id,
|
||||
# benefit_desc: benefit_descs["#{key}"],
|
||||
# benefit: value,
|
||||
# sequence: sequence,
|
||||
# plan_key: pl_plan_key
|
||||
# )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# plans.each do |plan|
|
||||
# plan_info = plan.last
|
||||
# plan_id = plan_info.delete(:plan_id).to_i
|
||||
# plan_info.each do |key, value|
|
||||
# sequence = key.delete_prefix("benefit_").to_i
|
||||
# Vhcs::HlEgglestonCardBenefit.create(
|
||||
# plan_id: plan_id,
|
||||
# benefit_desc: benefit_descs["#{key}"],
|
||||
# benefit: value,
|
||||
# sequence: sequence,
|
||||
# plan_key: pl_plan_key
|
||||
# )
|
||||
# end
|
||||
# end
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class PlanForm
|
||||
include ActiveModel::Model
|
||||
include ActiveModel::Attributes
|
||||
|
||||
attribute :plan_id, :string
|
||||
|
||||
def initialize(attributes = {})
|
||||
self.generate_attributes(14, "benefit_")
|
||||
super(attributes)
|
||||
end
|
||||
|
||||
def persisted?
|
||||
false
|
||||
end
|
||||
|
||||
def generate_attributes(count, prefix)
|
||||
count.times do |i|
|
||||
# attr_accessor :"#{prefix}#{i + 1}"
|
||||
self.class.attribute "#{prefix}#{i + 1}".to_sym, :string
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# dynamic_attribute_names.each do |attr_name|
|
||||
# # Define each attribute as a String type (you can customize the type)
|
||||
# self.class.attribute attr_name.to_sym, :string
|
||||
# end
|
||||
@@ -0,0 +1,2 @@
|
||||
module IdCardEmployersHelper
|
||||
end
|
||||
@@ -1,7 +1,9 @@
|
||||
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
|
||||
import "@hotwired/turbo-rails"
|
||||
import "controllers"
|
||||
import "trix"
|
||||
import "@rails/actiontext"
|
||||
import { Application } from "@hotwired/stimulus"
|
||||
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
|
||||
|
||||
console.log('Hello World from application.js');
|
||||
const application = Application.start()
|
||||
eagerLoadControllersFrom("controllers", application)
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static values = {
|
||||
formColor: { type: Array, default: [] } // Declares 'items' as an Array value
|
||||
}
|
||||
static targets = ["template", "container", "networkLogo", "button"]
|
||||
|
||||
add(event) {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
const content = this.#updateTemplateNetwork()
|
||||
|
||||
this.buttonTarget.insertAdjacentHTML('beforebegin', content);
|
||||
// this.containerTarget.insertAdjacentHTML("beforeend", content)
|
||||
}
|
||||
|
||||
remove(event) {
|
||||
event.preventDefault();
|
||||
const wrapper = event.target.closest(".network-item");
|
||||
if (wrapper.dataset.newRecord === "true") {
|
||||
wrapper.remove();
|
||||
} else {
|
||||
wrapper.style.display = "none";
|
||||
const destroyInput = wrapper.querySelector("input[name*='[_destroy]']");
|
||||
if (destroyInput) {
|
||||
destroyInput.value = "1";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#updateTemplateNetwork() {
|
||||
const nextIndex = this.networkLogoTargets.length
|
||||
const num_of_colors = this.formColorValue.length
|
||||
let colorIndex = 0
|
||||
let newSecondaryColor = "copper"
|
||||
if (nextIndex != 0) {
|
||||
colorIndex = nextIndex % num_of_colors
|
||||
if (nextIndex % 2 == 1) {
|
||||
newSecondaryColor = "bronze"
|
||||
}
|
||||
}
|
||||
const newColor = this.formColorValue[colorIndex]
|
||||
return this.templateTarget.innerHTML
|
||||
.replace(/NEW_RECORD/g, nextIndex)
|
||||
.replace(/NEXT_COLOR/g, newColor)
|
||||
.replace(/NEXT_SECONDARY_COLOR/g, newSecondaryColor)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static values = {
|
||||
parentColor: String
|
||||
}
|
||||
|
||||
static targets = ["template", "container"]
|
||||
|
||||
add(event) {
|
||||
console.log("start")
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
const content = this.#updateTemplateException()
|
||||
|
||||
this.containerTarget.insertAdjacentHTML("beforeend", content)
|
||||
|
||||
}
|
||||
|
||||
#updateTemplateException() {
|
||||
const nextIndex = new Date().getTime()
|
||||
console.log("~~ " + this.parentColorValue)
|
||||
return this.templateTarget.innerHTML
|
||||
.replace(/NEW_EXC_RECORD/g, nextIndex)
|
||||
.replace(/PARENT_SECONDARY_COLOR/g, this.parentColorValue)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static values = {
|
||||
formColor: { type: Array, default: [] } // Declares 'items' as an Array value
|
||||
}
|
||||
static targets = ["template", "container", "plan", "button"]
|
||||
|
||||
add(event) {
|
||||
console.log("start")
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
const content = this.#updateTemplatePlan()
|
||||
|
||||
this.buttonTarget.insertAdjacentHTML("beforebegin", content)
|
||||
|
||||
}
|
||||
|
||||
remove(event) {
|
||||
event.preventDefault();
|
||||
const wrapper = event.target.closest(".plan-item");
|
||||
if (wrapper.dataset.newRecord === "true") {
|
||||
wrapper.remove();
|
||||
} else {
|
||||
wrapper.style.display = "none";
|
||||
const destroyInput = wrapper.querySelector("input[name*='[_destroy]']");
|
||||
if (destroyInput) {
|
||||
destroyInput.value = "1";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#updateTemplatePlan() {
|
||||
const nextIndex = this.planTargets.length
|
||||
const num_of_colors = this.formColorValue.length
|
||||
let colorIndex = 0
|
||||
let newSecondaryColor = "copper"
|
||||
if (nextIndex != 0) {
|
||||
colorIndex = nextIndex % num_of_colors
|
||||
if (nextIndex % 2 == 1) {
|
||||
newSecondaryColor = "bronze"
|
||||
}
|
||||
}
|
||||
const newColor = this.formColorValue[colorIndex]
|
||||
return this.templateTarget.innerHTML
|
||||
.replace(/NEW_RECORD/g, nextIndex)
|
||||
.replace(/NEW_PLAN/g, nextIndex + 1)
|
||||
.replace(/NEXT_COLOR/g, newColor)
|
||||
.replace(/NEXT_SECONDARY_COLOR/g, newSecondaryColor)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,5 +7,3 @@ application.debug = false
|
||||
window.Stimulus = application
|
||||
|
||||
export { application }
|
||||
|
||||
console.log('Hello World from controllers/application.js');
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Controller } from "@hotwired/stimulus";
|
||||
|
||||
export default class extends Controller {
|
||||
static values = { url: String };
|
||||
static targets = ["benefit"];
|
||||
|
||||
connect() {
|
||||
}
|
||||
|
||||
async fetchData(event) {
|
||||
const templateId = event.target.value;
|
||||
if (!templateId) {
|
||||
this.clearFields();
|
||||
return;
|
||||
}
|
||||
|
||||
const url = `/id_card_benefits_templates/get_template_benefits/${templateId}`
|
||||
const response = await fetch(url);
|
||||
const templateBenefitsData = await response.json();
|
||||
|
||||
this.#updateFields(templateBenefitsData)
|
||||
}
|
||||
|
||||
clearFields() {
|
||||
}
|
||||
|
||||
async #updateFields(templateBenefitsData) {
|
||||
const benefitTargetsList = this.benefitTargets
|
||||
templateBenefitsData.forEach(function(bene) {
|
||||
const targetElement = benefitTargetsList.find(
|
||||
(element) => element.dataset.sequence == bene.sequence
|
||||
);
|
||||
if (targetElement) {
|
||||
targetElement.value = bene.benefit;
|
||||
} else {
|
||||
console.error(`Target not found for sequence: ${bene.sequence}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// this[propertyName]
|
||||
// const propertyName = `${valueName}Value`;
|
||||
@@ -0,0 +1,37 @@
|
||||
import { Controller } from "@hotwired/stimulus";
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["numberInput", "planFieldsContainer", "template"];
|
||||
|
||||
connect() {
|
||||
this.updatePlanFields();
|
||||
}
|
||||
|
||||
updatePlanFields() {
|
||||
const desiredCount = parseInt(this.numberInputTarget.value || 1, 10);
|
||||
const currentCount = this.planFieldsContainerTarget.children.length;
|
||||
|
||||
if (desiredCount > currentCount) {
|
||||
this.addPlanFields(desiredCount - currentCount);
|
||||
} else if (desiredCount < currentCount) {
|
||||
this.removePlanFields(currentCount - desiredCount);
|
||||
}
|
||||
}
|
||||
|
||||
addPlanFields(count) {
|
||||
for (let i = 0; i < count; i++) {
|
||||
const newPlanField = this.templateTarget.content.cloneNode(true);
|
||||
// Replace '__INDEX__' with a unique value for nested attributes
|
||||
// e.g., using Date.now() or a counter
|
||||
const uniqueIndex = Date.now() + i;
|
||||
newPlanField.innerHTML = newPlanField.innerHTML.replace(/__INDEX__/g, uniqueIndex);
|
||||
this.planFieldsContainerTarget.appendChild(newPlanField);
|
||||
}
|
||||
}
|
||||
|
||||
removePlanFields(count) {
|
||||
for (let i = 0; i < count; i++) {
|
||||
this.planFieldsContainerTarget.lastElementChild.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["divA"] // Add targets for all your divs
|
||||
|
||||
connect() {
|
||||
this.toggleDivs() // Call on connect to set initial state
|
||||
}
|
||||
|
||||
toggleDivs() {
|
||||
const selectedValue = this.element.querySelector('select').value;
|
||||
console.log("sv: ")
|
||||
|
||||
// Hide all divs first
|
||||
this.divATarget.classList.add("hidden");
|
||||
|
||||
// Show the relevant div based on selection
|
||||
if (selectedValue === "cig+") {
|
||||
this.divATarget.classList.remove("hidden");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
import { Controller } from "@hotwired/stimulus";
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["preview", "previewContainer", "logoSelect", "logofield", "initialLogoFile"];
|
||||
|
||||
async connect() {
|
||||
console.log(this.logofieldTarget.value)
|
||||
if (this.logofieldTarget.value.includes("Logo.")) {
|
||||
const response = await fetch(`/card_logo_files/${this.logofieldTarget.value}/image`); // Fetch the binary data
|
||||
const blob = await response.blob();
|
||||
const objectUrl = URL.createObjectURL(blob);
|
||||
this.previewTarget.src = objectUrl;
|
||||
this.previewContainerTarget.classList.remove("hidden");
|
||||
}
|
||||
// Remember to revoke the URL when the controller is disconnected if necessary
|
||||
// this.disconnect = () => URL.revokeObjectURL(objectUrl);
|
||||
}
|
||||
|
||||
uploadLogo(event) {
|
||||
console.log('in uploadLogo');
|
||||
event.preventDefault()
|
||||
const file = event.target.files[0];
|
||||
if (!file) return;
|
||||
|
||||
const logoType = event.params.type
|
||||
|
||||
let newFileName = file.name
|
||||
if (logoType == "network") {
|
||||
console.log("n " + newFileName);
|
||||
newFileName = this.determineNetworkFilename(file)
|
||||
this.addOptionToSelect(newFileName)
|
||||
} else if (logoType == "employer") {
|
||||
newFileName = this.determineEmployerFilename(file)
|
||||
this.logofieldTarget.value = newFileName;
|
||||
}
|
||||
|
||||
this.previewFile(file);
|
||||
|
||||
// this.uploadLogoToServer(file);
|
||||
|
||||
|
||||
}
|
||||
|
||||
previewFile(file) {
|
||||
console.log('in previewFile');
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
this.previewTarget.src = e.target.result;
|
||||
this.previewContainerTarget.classList.remove("hidden");
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
|
||||
async uploadLogoToServer(file) {
|
||||
console.log('in uploadLogoToServer');
|
||||
const formData = new FormData();
|
||||
formData.append("card_logo_file[logo_file]", file);
|
||||
formData.append("card_logo_file[logo_type]", "employer");
|
||||
|
||||
const csrfToken = document.querySelector("meta[name='csrf-token']").content;
|
||||
|
||||
try {
|
||||
const response = await fetch("/card_logo_files/", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-CSRF-Token": csrfToken
|
||||
},
|
||||
body: formData
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
console.log('Upload successful!')
|
||||
} else {
|
||||
console.error("Failed to track event.");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Network error:", error);
|
||||
}
|
||||
}
|
||||
|
||||
addOptionToSelect(name) {
|
||||
const blankOptionIndex = 0;
|
||||
const newOption = new Option(name, name, true, true)
|
||||
|
||||
if (this.logoSelectTarget.options.length > blankOptionIndex + 1) {
|
||||
this.logoSelectTarget.insertBefore(newOption, this.logoSelectTarget.options[blankOptionIndex + 1]);
|
||||
} else {
|
||||
this.logoSelectTarget.appendChild(newOption);
|
||||
}
|
||||
|
||||
this.logoSelectTarget.value = name;
|
||||
}
|
||||
|
||||
determineNetworkFilename(file) {
|
||||
const fileExtension = file.name.split('.').pop();
|
||||
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 logoFilename = this.titleizeText(primaryNetworkName).concat(this.titleizeText(secondaryNetworkName)).concat("Logo.").concat(fileExtension).replaceAll(' ', '');
|
||||
|
||||
return logoFilename
|
||||
}
|
||||
|
||||
determineEmployerFilename(file) {
|
||||
const fileExtension = file.name.split('.').pop();
|
||||
const employerName = prompt("Enter the name for the new Employer (minus any 'The's, 'LLC', or 'Health Plan'):");
|
||||
const logoFilename = this.titleizeText(employerName).concat("Logo.").concat(fileExtension).replaceAll(' ', '');
|
||||
|
||||
return logoFilename
|
||||
}
|
||||
|
||||
titleizeText(text) {
|
||||
const titleized = text.toLowerCase();
|
||||
|
||||
return titleized.replace(/(^|\s)\S/g, function(match) {
|
||||
return match.toUpperCase();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
class AlternateNetworkLogo < ApplicationRecord
|
||||
belongs_to :employer
|
||||
|
||||
# before_save :process_network_logo
|
||||
|
||||
def process_network_logo
|
||||
if self.network_logo.present? && !self.network_logo.is_a?(String)
|
||||
self.employer_setup_process.card_logo_files.new(
|
||||
filename: self.network_logo.filename,
|
||||
logo_type: 'network',
|
||||
image: self.network_logo.data,
|
||||
pl_plan_key: self.employer_setup_process.pl_plan_key || ""
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2,4 +2,6 @@
|
||||
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
primary_abstract_class
|
||||
|
||||
establish_connection :baclight
|
||||
end
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
class Article < ApplicationRecord
|
||||
has_many :comments, dependent: :destroy
|
||||
has_rich_text :content
|
||||
validates_presence_of :title
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
module BrittonWeb
|
||||
class Employers < BrittonWebRecord
|
||||
|
||||
# self.table_name = 'employers'
|
||||
|
||||
alias_attribute :id, :id
|
||||
alias_attribute :name, :name
|
||||
alias_attribute :pl_plan_key, :pl_plan_key
|
||||
alias_attribute :plan_id, :plan_id
|
||||
alias_attribute :dental_plan, :dental_plan
|
||||
alias_attribute :single_card_template, :single_card_template
|
||||
alias_attribute :multiple_card_template, :multiple_card_template
|
||||
alias_attribute :logo, :logo
|
||||
alias_attribute :active, :active
|
||||
alias_attribute :broker_id, :broker_id
|
||||
alias_attribute :created_at, :created_at
|
||||
alias_attribute :updated_at, :updated_at
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
module BrittonWeb
|
||||
class NetworkLogos < BrittonWebRecord
|
||||
|
||||
self.table_name = 'network_logos'
|
||||
|
||||
alias_attribute :id, :id
|
||||
alias_attribute :net_logo, :net_logo
|
||||
alias_attribute :exception_type, :exception_type
|
||||
alias_attribute :exception_value, :exception_value
|
||||
alias_attribute :default, :default
|
||||
alias_attribute :employer_id, :employer_id
|
||||
alias_attribute :created_at, :created_at
|
||||
alias_attribute :updated_at, :updated_at
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class BrittonWebRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
connects_to database: { writing: :britton_web, reading: :britton_web }
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class CardLogoFile < ApplicationRecord
|
||||
has_many :employer_card_logos, dependent: :destroy
|
||||
has_many :employers, through: :employer_card_logos
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class CardProvider < ApplicationRecord
|
||||
has_many :employers
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class CardRx < ApplicationRecord
|
||||
has_many :employers
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
class Comment < ApplicationRecord
|
||||
belongs_to :article
|
||||
broadcasts_to :article
|
||||
end
|
||||
@@ -0,0 +1,155 @@
|
||||
class Employer < ApplicationRecord
|
||||
has_many :members
|
||||
has_many :plans, dependent: :destroy
|
||||
accepts_nested_attributes_for :plans, allow_destroy: true, reject_if: :all_blank
|
||||
|
||||
has_many :alternate_network_logos, dependent: :destroy
|
||||
accepts_nested_attributes_for :alternate_network_logos, allow_destroy: true, reject_if: :all_blank
|
||||
|
||||
has_many :employer_card_logos, dependent: :destroy
|
||||
accepts_nested_attributes_for :employer_card_logos
|
||||
has_many :card_logo_files, through: :employer_card_logos
|
||||
has_one :employer_brand_logo, -> { where(logo_type: 'employer') },
|
||||
class_name: 'EmployerCardLogo',
|
||||
dependent: :destroy
|
||||
has_one :employer_logo, through: :employer_brand_logo, source: :card_logo_file
|
||||
|
||||
has_many :network_images, -> { where(logo_type: 'network') },
|
||||
class_name: 'EmployerCardLogo',
|
||||
dependent: :destroy
|
||||
has_many :network_logos, through: :network_images, source: :card_logo_file
|
||||
|
||||
belongs_to :card_provider, optional: true
|
||||
belongs_to :card_rx, optional: true
|
||||
|
||||
scope :active, -> { where(active: true) }
|
||||
scope :inactive, -> { where(active: false) }
|
||||
|
||||
|
||||
|
||||
# before_save :process_employer_logo
|
||||
# before_save :process_employer_logo, if: :employer_logo_filename_changed?
|
||||
before_save :create_slug, if: :new_record?
|
||||
after_save :process_employer_logo, if: :saved_change_to_employer_logo_filename?
|
||||
|
||||
def process_employer_logo
|
||||
# if self.employer_logo.present? && !self.employer_logo.is_a?(String)
|
||||
# self.card_logo_files.new(
|
||||
# filename: self.employer_logo.filename,
|
||||
# logo_type: 'employer',
|
||||
# image: self.employer_logo.data,
|
||||
# pl_plan_key: self.pl_plan_key || ""
|
||||
# )
|
||||
# end
|
||||
if self.employer_logo_filename.present? && self.employer_logo_filename.is_a?(String)
|
||||
image_file = CardLogoFile.find_by(filename: self.employer_logo_filename)
|
||||
if image_file.present?
|
||||
if self.employer_brand_logo.present?
|
||||
self.employer_brand_logo.update(card_logo_file: image_file)
|
||||
else
|
||||
self.create_employer_brand_logo(card_logo_file: image_file, logo_type: 'employer')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def create_slug
|
||||
self.slug = employer_trim_name(self.name).parameterize
|
||||
end
|
||||
|
||||
def name_to_logo_filename(extension)
|
||||
self.employer_trim_name(self.name).titleize.gsub(/\s+/, '').concat('Logo').concat(extension.downcase)
|
||||
end
|
||||
|
||||
def employer_trim_name(name)
|
||||
regex_source = Regexp.union(["health", "plan", "the", "inc", "llc"]).source
|
||||
case_insensitive_regex = Regexp.new(regex_source, "i")
|
||||
name.gsub(case_insensitive_regex, "").squish
|
||||
end
|
||||
|
||||
def self.permitted_params(params)
|
||||
params.require(:employer).permit(
|
||||
:name,
|
||||
:group_number,
|
||||
:pl_plan_key,
|
||||
:effective_date,
|
||||
:employer_logo_filename,
|
||||
:network_provider,
|
||||
:default_network_logo,
|
||||
:single_card_template,
|
||||
:card_provider_id,
|
||||
:card_rx_id,
|
||||
plans_attributes: [
|
||||
:id,
|
||||
:title,
|
||||
:pb_product_key,
|
||||
:_destroy,
|
||||
plan_benefits_attributes: [
|
||||
:id,
|
||||
:benefit_desc,
|
||||
:benefit,
|
||||
:sequence,
|
||||
:_destroy,
|
||||
]
|
||||
],
|
||||
alternate_network_logos_attributes: [
|
||||
:id,
|
||||
:network_logo,
|
||||
:exception_type,
|
||||
:exception_value,
|
||||
:_destroy
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
def save_to_prod
|
||||
|
||||
VhcsRecord.transaction do
|
||||
Vhcs::HlPlanCode.create!(
|
||||
group_number: self.group_number,
|
||||
medical_number: self.group_number,
|
||||
dental_number: '',
|
||||
plan_key: self.pl_plan_key,
|
||||
effect_date: self.effective_date
|
||||
)
|
||||
|
||||
# Replace fairos_info with template like for benefits
|
||||
fairos_info = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first
|
||||
Vhcs::HlrxCrosRef.create!(
|
||||
group_no: self.group_number,
|
||||
rx_group_id: self.group_number,
|
||||
help_desk: fairos_info.help_desk,
|
||||
customer_service: fairos_info.customer_service,
|
||||
web_url: fairos_info.web_url,
|
||||
pl_plan_key: self.pl_plan_key
|
||||
)
|
||||
|
||||
self.plans.each_with_index do |plan, i|
|
||||
plan.plan_benefits.each do |bene|
|
||||
Vhcs::HlEgglestonCardBenefit.create!(
|
||||
plan_id: plan.plan_id,
|
||||
benefit_desc: bene.benefit_desc,
|
||||
benefit: bene.benefit,
|
||||
sequence: bene.sequence,
|
||||
plan_key: self.pl_plan_key
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def build_plan_with_default_benefits(attributes = {})
|
||||
plan = plans.new(attributes)
|
||||
benefits = IdCardBenefitsTemplate.find_by(title: "BLANK").id_card_benefits.sort_by(&:sequence)
|
||||
benefits.each do |ben|
|
||||
plan.plan_benefits.new(benefit_desc: ben.benefit_desc, sequence: ben.sequence)
|
||||
end
|
||||
plan
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class EmployerCardLogo < ApplicationRecord
|
||||
belongs_to :employer
|
||||
belongs_to :card_logo_file
|
||||
|
||||
end
|
||||
@@ -0,0 +1,106 @@
|
||||
class EmployerSetupProcess < ApplicationRecord
|
||||
has_many :plans, dependent: :destroy
|
||||
accepts_nested_attributes_for :plans, allow_destroy: true, reject_if: :all_blank
|
||||
|
||||
has_many :alternate_network_logos, dependent: :destroy
|
||||
accepts_nested_attributes_for :alternate_network_logos, allow_destroy: true, reject_if: :all_blank
|
||||
|
||||
has_many :card_logo_files
|
||||
|
||||
# before_save :process_employer_logo
|
||||
before_save :create_slug, if: :new_record?
|
||||
|
||||
def process_employer_logo
|
||||
if self.employer_logo.present? && !self.employer_logo.is_a?(String)
|
||||
self.card_logo_files.new(
|
||||
filename: self.employer_logo.filename,
|
||||
logo_type: 'employer',
|
||||
image: self.employer_logo.data,
|
||||
pl_plan_key: self.pl_plan_key || ""
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def create_slug
|
||||
self.slug = employer_trimmed_name.parameterize
|
||||
end
|
||||
|
||||
def employer_name_to_logo_filename(extension)
|
||||
self.employer_trimmed_name.titleize.gsub(/\s+/, '').concat('Logo').concat(extension.downcase)
|
||||
end
|
||||
|
||||
def employer_trimmed_name
|
||||
regex_source = Regexp.union(["health", "plan", "the", "inc", "llc"]).source
|
||||
case_insensitive_regex = Regexp.new(regex_source, "i")
|
||||
self.employer_name.gsub(case_insensitive_regex, "").squish
|
||||
end
|
||||
|
||||
def self.permitted_params(params)
|
||||
params.require(:employer_setup_process).permit(
|
||||
:employer_name,
|
||||
:group_number,
|
||||
:pl_plan_key,
|
||||
:effective_date,
|
||||
:employer_logo,
|
||||
:network_provider,
|
||||
plans_attributes: [
|
||||
:id,
|
||||
:title,
|
||||
:plan_id,
|
||||
:_destroy,
|
||||
plan_benefits_attributes: [
|
||||
:id,
|
||||
:benefit_desc,
|
||||
:benefit,
|
||||
:sequence,
|
||||
:_destroy,
|
||||
]
|
||||
],
|
||||
alternate_network_logos_attributes: [
|
||||
:id,
|
||||
:network_logo,
|
||||
:exception_type,
|
||||
:exception_value,
|
||||
:_destroy
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
def save_to_prod
|
||||
|
||||
VhcsRecord.transaction do
|
||||
Vhcs::HlPlanCode.create!(
|
||||
group_number: self.group_number,
|
||||
medical_number: self.group_number,
|
||||
dental_number: '',
|
||||
plan_key: self.pl_plan_key,
|
||||
effect_date: self.effective_date
|
||||
)
|
||||
|
||||
# Replace fairos_info with template like for benefits
|
||||
fairos_info = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first
|
||||
Vhcs::HlrxCrosRef.cdarreate!(
|
||||
group_no: self.group_number,
|
||||
rx_group_id: self.group_number,
|
||||
help_desk: fairos_info.help_desk,
|
||||
customer_service: fairos_info.customer_service,
|
||||
web_url: fairos_info.web_url,
|
||||
pl_plan_key: self.pl_plan_key
|
||||
)
|
||||
|
||||
self.plans.each_with_index do |plan, i|
|
||||
plan.plan_benefits.each do |bene|
|
||||
Vhcs::HlEgglestonCardBenefit.create!(
|
||||
plan_id: plan.plan_id,
|
||||
benefit_desc: bene.benefit_desc,
|
||||
benefit: bene.benefit,
|
||||
sequence: bene.sequence,
|
||||
plan_key: self.pl_plan_key
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class IdCardBenefit < ApplicationRecord
|
||||
belongs_to :id_card_benefits_template
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class IdCardBenefitsTemplate < ApplicationRecord
|
||||
|
||||
has_many :id_card_benefits, dependent: :destroy
|
||||
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
class Member < ApplicationRecord
|
||||
belongs_to :plan
|
||||
belongs_to :employer
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
class Plan < ApplicationRecord
|
||||
belongs_to :employer
|
||||
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?
|
||||
|
||||
|
||||
|
||||
private
|
||||
|
||||
def build_and_create_default_benefits
|
||||
benefits = IdCardBenefitsTemplate.find_by(title: "BLANK").id_card_benefits.sort_by(&:sequence)
|
||||
benefits.each do |ben|
|
||||
plan_benefits.new(benefit_desc: ben.benefit_desc, sequence: ben.sequence)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class PlanBenefit < ApplicationRecord
|
||||
belongs_to :plan
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
class SampleIdCard < 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]
|
||||
|
||||
before_validation :assign_blank_strings_to_unassigned_params
|
||||
|
||||
def assign_blank_strings_to_unassigned_params
|
||||
STRING_ATTRIBUTES.each do |attr|
|
||||
# Use the blank? method which checks for nil, false, empty, or whitespace strings
|
||||
self[attr] = "" if self[attr].blank?
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
module Vhcs
|
||||
class HLEggIdCardDependent < VhcsRecord
|
||||
|
||||
self.table_name = 'HLEggIdCardDependent'
|
||||
|
||||
alias_attribute :id, :Id
|
||||
alias_attribute :family_id, :FamilyId
|
||||
alias_attribute :dependent_name, :DependentName
|
||||
alias_attribute :sequence_number, :SequenceNumber
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
module Vhcs
|
||||
class HlEgglestonCardBenefit < VhcsRecord
|
||||
|
||||
self.table_name = 'HLEgglestonCardBenefit'
|
||||
|
||||
alias_attribute :id, :Id
|
||||
alias_attribute :plan_id, :PlanId
|
||||
alias_attribute :benefit_desc, :BenefitDesc
|
||||
alias_attribute :benefit, :Benefit
|
||||
alias_attribute :sequence, :Sequence
|
||||
alias_attribute :plan_key, :PlanKey
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
module Vhcs
|
||||
class HlPlanCode < VhcsRecord
|
||||
|
||||
self.table_name = 'HlPlanCode'
|
||||
|
||||
alias_attribute :id, :ID
|
||||
alias_attribute :group_number, :GroupNumber
|
||||
alias_attribute :medical_number, :MedicalNumber
|
||||
alias_attribute :dental_number, :DentalNumber
|
||||
alias_attribute :plan_key, :PlanKey
|
||||
alias_attribute :effect_date, :EffectDate
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,98 @@
|
||||
module Vhcs
|
||||
class HlidCardProvider < VhcsRecord
|
||||
|
||||
self.table_name = 'HLIDCardProvider'
|
||||
self.primary_key = 'ProviderCode'
|
||||
|
||||
alias_attribute :provider_code, :ProviderCode
|
||||
alias_attribute :provider_line_1, :ProviderLine1
|
||||
alias_attribute :provider_line_2, :ProviderLine2
|
||||
alias_attribute :provider_line_3, :ProviderLine3
|
||||
alias_attribute :provider_line_4, :ProviderLine4
|
||||
alias_attribute :provider_line_5, :ProviderLine5
|
||||
alias_attribute :mail_to, :MailTo
|
||||
alias_attribute :mail_to_2, :MailTo2
|
||||
alias_attribute :contact_line_1, :ContactLine1
|
||||
alias_attribute :contact_line_2, :ContactLine2
|
||||
alias_attribute :contact_line_3, :ContactLine3
|
||||
alias_attribute :group_number, :GroupNumber
|
||||
alias_attribute :claim_to_1, :ClaimTo1
|
||||
alias_attribute :claim_to_2, :ClaimTo2
|
||||
alias_attribute :claim_to_3, :ClaimTo3
|
||||
alias_attribute :claim_to_4, :ClaimTo4
|
||||
alias_attribute :claim_to_5, :ClaimTo5
|
||||
alias_attribute :claim_to_6, :ClaimTo6
|
||||
alias_attribute :claim_to_7, :ClaimTo7
|
||||
alias_attribute :claim_to_8, :ClaimTo8
|
||||
alias_attribute :claim_to_9, :ClaimTo9
|
||||
alias_attribute :claim_to_10, :ClaimTo10
|
||||
alias_attribute :claim_to_11, :ClaimTo11
|
||||
alias_attribute :provider_line_6, :ProviderLine6
|
||||
alias_attribute :provider_line_7, :ProviderLine7
|
||||
alias_attribute :provider_line_8, :ProviderLine8
|
||||
alias_attribute :provider_line_9, :ProviderLine9
|
||||
alias_attribute :provider_line_10, :ProviderLine10
|
||||
alias_attribute :provider_line_11, :ProviderLine11
|
||||
alias_attribute :rx_group_id, :RXGroupId
|
||||
alias_attribute :rx_contact, :RXContact
|
||||
alias_attribute :provider_lookup_1, :ProviderLookup1
|
||||
alias_attribute :provider_lookup_2, :ProviderLookup2
|
||||
alias_attribute :precert_1, :Precert1
|
||||
alias_attribute :precert_2, :Precert2
|
||||
alias_attribute :precert_3, :Precert3
|
||||
alias_attribute :precert_4, :Precert4
|
||||
alias_attribute :precert_5, :Precert5
|
||||
alias_attribute :precert_6, :Precert6
|
||||
alias_attribute :provider_line_12, :ProviderLine12
|
||||
alias_attribute :claim_to_12, :ClaimTo12
|
||||
|
||||
def attributes
|
||||
rails_like = {
|
||||
provider_code: self.provider_code,
|
||||
provider_line_1: self.provider_line_1,
|
||||
provider_line_2: self.provider_line_2,
|
||||
provider_line_3: self.provider_line_3,
|
||||
provider_line_4: self.provider_line_4,
|
||||
provider_line_5: self.provider_line_5,
|
||||
mail_to: self.mail_to,
|
||||
mail_to_2: self.mail_to_2,
|
||||
contact_line_1: self.contact_line_1,
|
||||
contact_line_2: self.contact_line_2,
|
||||
contact_line_3: self.contact_line_3,
|
||||
group_number: self.group_number,
|
||||
claim_to_1: self.claim_to_1,
|
||||
claim_to_2: self.claim_to_2,
|
||||
claim_to_3: self.claim_to_3,
|
||||
claim_to_4: self.claim_to_4,
|
||||
claim_to_5: self.claim_to_5,
|
||||
claim_to_6: self.claim_to_6,
|
||||
claim_to_7: self.claim_to_7,
|
||||
claim_to_8: self.claim_to_8,
|
||||
claim_to_9: self.claim_to_9,
|
||||
claim_to_10: self.claim_to_10,
|
||||
claim_to_11: self.claim_to_11,
|
||||
claim_to_12: self.claim_to_12,
|
||||
provider_line_6: self.provider_line_6,
|
||||
provider_line_7: self.provider_line_7,
|
||||
provider_line_8: self.provider_line_8,
|
||||
provider_line_9: self.provider_line_9,
|
||||
provider_line_10: self.provider_line_10,
|
||||
provider_line_11: self.provider_line_11,
|
||||
provider_line_12: self.provider_line_12,
|
||||
rx_group_id: self.rx_group_id,
|
||||
rx_contact: self.rx_contact,
|
||||
provider_lookup_1: self.provider_lookup_1,
|
||||
provider_lookup_2: self.provider_lookup_2,
|
||||
precert_1: self.precert_1,
|
||||
precert_2: self.precert_2,
|
||||
precert_3: self.precert_3,
|
||||
precert_4: self.precert_4,
|
||||
precert_5: self.precert_5,
|
||||
precert_6: self.precert_6,
|
||||
}
|
||||
super.merge(rails_like)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,48 @@
|
||||
module Vhcs
|
||||
class HlidCardProvider < VhcsRecord
|
||||
|
||||
self.table_name = 'HLIDCardProvider'
|
||||
|
||||
alias_attribute :provider_code, :ProviderCode
|
||||
alias_attribute :provider_line_1, :ProviderLine1
|
||||
alias_attribute :provider_line_2, :ProviderLine2
|
||||
alias_attribute :provider_line_3, :ProviderLine3
|
||||
alias_attribute :provider_line_4, :ProviderLine4
|
||||
alias_attribute :provider_line_5, :ProviderLine5
|
||||
alias_attribute :mail_to, :MailTo
|
||||
alias_attribute :mail_to_2, :MailTo2
|
||||
alias_attribute :contact_line_1, :ContactLine1
|
||||
alias_attribute :contact_line_2, :ContactLine2
|
||||
alias_attribute :contact_line_3, :ContactLine3
|
||||
alias_attribute :group_number, :GroupNumber
|
||||
alias_attribute :claim_to_1, :ClaimTo1
|
||||
alias_attribute :claim_to_2, :ClaimTo2
|
||||
alias_attribute :claim_to_3, :ClaimTo3
|
||||
alias_attribute :claim_to_4, :ClaimTo4
|
||||
alias_attribute :claim_to_5, :ClaimTo5
|
||||
alias_attribute :claim_to_6, :ClaimTo6
|
||||
alias_attribute :claim_to_7, :ClaimTo7
|
||||
alias_attribute :claim_to_8, :ClaimTo8
|
||||
alias_attribute :claim_to_9, :ClaimTo9
|
||||
alias_attribute :claim_to_10, :ClaimTo10
|
||||
alias_attribute :claim_to_11, :ClaimTo11
|
||||
alias_attribute :provider_line_6, :ProviderLine6
|
||||
alias_attribute :provider_line_7, :ProviderLine7
|
||||
alias_attribute :provider_line_8, :ProviderLine8
|
||||
alias_attribute :provider_line_9, :ProviderLine9
|
||||
alias_attribute :provider_line_10, :ProviderLine10
|
||||
alias_attribute :provider_line_11, :ProviderLine11
|
||||
alias_attribute :rx_group_id, :RXGroupId
|
||||
alias_attribute :rx_contact, :RXContact
|
||||
alias_attribute :provider_lookup_1, :ProviderLookup1
|
||||
alias_attribute :provider_lookup_2, :ProviderLookup2
|
||||
alias_attribute :precert1, :Precert1
|
||||
alias_attribute :precert2, :Precert2
|
||||
alias_attribute :precert3, :Precert3
|
||||
alias_attribute :precert4, :Precert4
|
||||
alias_attribute :precert5, :Precert5
|
||||
alias_attribute :precert6, :Precert6
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,25 @@
|
||||
module Vhcs
|
||||
class HLIDCardsEgg < VhcsRecord
|
||||
|
||||
self.table_name = 'HLIDCardsEgg'
|
||||
|
||||
alias_attribute :facility, :Facility
|
||||
alias_attribute :division, :Division
|
||||
alias_attribute :full_name, :FullName
|
||||
alias_attribute :ssn, :SSN
|
||||
alias_attribute :medical_coverage, :MedicalCoverage
|
||||
alias_attribute :medical_eff_date, :MedicalEffDate
|
||||
alias_attribute :medical_group_num, :MedicalGroupNum
|
||||
alias_attribute :dental_coverage, :DentalCoverage
|
||||
alias_attribute :dental_eff_date, :DentalEffDate
|
||||
alias_attribute :dental_group_num, :DentalGroupNum
|
||||
alias_attribute :card_type, :CardType
|
||||
alias_attribute :group_number, :GroupNumber
|
||||
alias_attribute :pb_product_key, :PBProductKey
|
||||
alias_attribute :id, :Id
|
||||
alias_attribute :pl_plan_key, :PLPlanKey
|
||||
alias_attribute :mb_member_key, :MBMemberKey
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,27 @@
|
||||
module Vhcs
|
||||
class HlrxCrosRef < VhcsRecord
|
||||
|
||||
self.table_name = 'HLRXCrosRef'
|
||||
|
||||
alias_attribute :group_no, :GroupNo
|
||||
alias_attribute :rx_group_id, :RXGroupID
|
||||
alias_attribute :help_desk, :HelpDesk
|
||||
alias_attribute :customer_service, :CustomerService
|
||||
alias_attribute :web_url, :WebUrl
|
||||
alias_attribute :pl_plan_key, :PLPlanKey
|
||||
|
||||
def attributes
|
||||
rails_like = {
|
||||
group_no: self.group_no,
|
||||
rx_group_id: self.rx_group_id,
|
||||
help_desk: self.help_desk,
|
||||
customer_service: self.customer_service,
|
||||
web_url: self.web_url,
|
||||
pl_plan_key: self.pl_plan_key,
|
||||
}
|
||||
super.merge(rails_like)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
module Vhcs
|
||||
class HlrxCrosRef < VhcsRecord
|
||||
|
||||
self.table_name = 'HLRXCrosRef'
|
||||
|
||||
alias_attribute :group_no, :GroupNo
|
||||
alias_attribute :rx_group_id, :RXGroupID
|
||||
alias_attribute :help_desk, :HelpDesk
|
||||
alias_attribute :customer_service, :CustomerService
|
||||
alias_attribute :web_url, :WebUrl
|
||||
alias_attribute :pl_plan_key, :PLPlanKey
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,23 @@
|
||||
module Vhcs
|
||||
class PbCompanyPlans < VhcsRecord
|
||||
|
||||
self.table_name = 'PBCompanyPlans'
|
||||
|
||||
alias_attribute :pb_company_plan_key, :PBCompanyPlanKey
|
||||
alias_attribute :company_pb_entity_key, :CompanyPBEntityKey
|
||||
alias_attribute :pl_plan_key, :PLPlanKey
|
||||
|
||||
|
||||
def attributes
|
||||
rails_like = {
|
||||
pb_company_plan_key: self.pb_company_plan_key,
|
||||
company_pb_entity_key: self.company_pb_entity_key,
|
||||
pl_plan_key: self.pl_plan_key,
|
||||
}
|
||||
super.merge(rails_like)
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,47 @@
|
||||
module Vhcs
|
||||
class PbEntity < VhcsRecord
|
||||
|
||||
self.table_name = 'PBEntity'
|
||||
|
||||
alias_attribute :pb_entity_key, :PBEntityKey
|
||||
alias_attribute :company_pb_entity_key, :CompanyPBEntityKey
|
||||
alias_attribute :entity_type_id, :EntityTypeID
|
||||
alias_attribute :prefix_id, :PrefixID
|
||||
alias_attribute :first_name, :FirstName
|
||||
alias_attribute :middle_name, :MiddleName
|
||||
alias_attribute :last_name, :LastName
|
||||
alias_attribute :suffix_id, :SuffixID
|
||||
alias_attribute :title, :Title
|
||||
alias_attribute :letter_tag_bit_flags, :LetterTagBitFlags
|
||||
alias_attribute :when_last_changed, :WhenLastChanged
|
||||
alias_attribute :who_last_changed, :WhoLastChanged
|
||||
alias_attribute :full_name_last_name_first, :FullNameLastNameFirst
|
||||
alias_attribute :alternate_key, :AlternateKey
|
||||
|
||||
def attributes
|
||||
rails_like = {
|
||||
pb_entity_key: self.pb_entity_key,
|
||||
company_pb_entity_key: self.company_pb_entity_key,
|
||||
entity_type_id: self.entity_type_id,
|
||||
prefix_id: self.prefix_id,
|
||||
first_name: self.first_name,
|
||||
middle_name: self.middle_name,
|
||||
last_name: self.last_name,
|
||||
suffix_id: self.suffix_id,
|
||||
title: self.title,
|
||||
letter_tag_bit_flags: self.letter_tag_bit_flags,
|
||||
when_last_changed: self.when_last_changed,
|
||||
who_last_changed: self.who_last_changed,
|
||||
full_name_last_name_first: self.full_name_last_name_first,
|
||||
alternate_key: self.alternate_key,
|
||||
}
|
||||
super.merge(rails_like)
|
||||
end
|
||||
|
||||
def full_name
|
||||
[self.first_name, self.middle_name, self.last_name].join(" ").squish
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,57 @@
|
||||
module Vhcs
|
||||
class PbProduct < VhcsRecord
|
||||
|
||||
self.table_name = 'PBProduct'
|
||||
|
||||
alias_attribute :pb_product_key, :PBProductKey
|
||||
alias_attribute :pb_product_line_key, :PBProductLineKey
|
||||
alias_attribute :target_entity_type_id, :TargetEntityTypeID
|
||||
alias_attribute :company_pb_entity_key, :CompanyPBEntityKey
|
||||
alias_attribute :full_description, :FullDescription
|
||||
alias_attribute :column_description, :ColumnDescription
|
||||
alias_attribute :short_description, :ShortDescription
|
||||
alias_attribute :presentation_format_code, :PresentationFormatCode
|
||||
alias_attribute :is_active, :IsActive
|
||||
alias_attribute :used_for_hrafsa, :UsedForHRAFSA
|
||||
alias_attribute :non_network_rx_coverage, :NonNetworkRxCoverage
|
||||
alias_attribute :web_express_product_group_g_1_0, :WebExpressProductGroup_G10
|
||||
alias_attribute :web_express_description, :WebExpressDescription
|
||||
alias_attribute :web_express_oe_processing_order, :WebExpressOEProcessingOrder
|
||||
alias_attribute :participant_enrollee_type_bitmask, :ParticipantEnrolleeTypeBitmask
|
||||
alias_attribute :invoice_group_g_1_2_7, :InvoiceGroup_G127
|
||||
alias_attribute :web_express_must_participate, :WebExpressMustParticipate
|
||||
alias_attribute :suppress_optional_amount, :SuppressOptionalAmount
|
||||
alias_attribute :suppress_coverage, :SuppressCoverage
|
||||
alias_attribute :suppress_description, :SuppressDescription
|
||||
alias_attribute :pb_product_enrollment_grouping_key, :PBProductEnrollmentGroupingKey
|
||||
|
||||
def attributes
|
||||
rails_like = {
|
||||
pb_product_key: self.pb_product_key,
|
||||
pb_product_line_key: self.pb_product_line_key,
|
||||
target_entity_type_id: self.target_entity_type_id,
|
||||
company_pb_entity_key: self.company_pb_entity_key,
|
||||
full_description: self.full_description,
|
||||
column_description: self.column_description,
|
||||
short_description: self.short_description,
|
||||
presentation_format_code: self.presentation_format_code,
|
||||
is_active: self.is_active,
|
||||
used_for_hrafsa: self.used_for_hrafsa,
|
||||
non_network_rx_coverage: self.non_network_rx_coverage,
|
||||
web_express_product_group_g_1_0: self.web_express_product_group_g_1_0,
|
||||
web_express_description: self.web_express_description,
|
||||
web_express_oe_processing_order: self.web_express_oe_processing_order,
|
||||
participant_enrollee_type_bitmask: self.participant_enrollee_type_bitmask,
|
||||
invoice_group_g_1_2_7: self.invoice_group_g_1_2_7,
|
||||
web_express_must_participate: self.web_express_must_participate,
|
||||
suppress_optional_amount: self.suppress_optional_amount,
|
||||
suppress_coverage: self.suppress_coverage,
|
||||
suppress_description: self.suppress_description,
|
||||
pb_product_enrollment_grouping_key: self.pb_product_enrollment_grouping_key,
|
||||
}
|
||||
super.merge(rails_like)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,55 @@
|
||||
module Vhcs
|
||||
class PbProductParticipation < VhcsRecord
|
||||
|
||||
self.table_name = 'PBProductParticipation'
|
||||
|
||||
alias_attribute :pb_product_participation_key, :PBProductParticipationKey
|
||||
alias_attribute :pb_affiliation_key, :PBAffiliationKey
|
||||
alias_attribute :pb_product_availability_key, :PBProductAvailabilityKey
|
||||
alias_attribute :coverage_type_code, :CoverageTypeCode
|
||||
alias_attribute :optional_amount, :OptionalAmount
|
||||
alias_attribute :in_effect, :InEffect
|
||||
alias_attribute :out_of_effect, :OutOfEffect
|
||||
alias_attribute :in_effect_reason_code, :InEffectReasonCode
|
||||
alias_attribute :out_of_effect_reason_code, :OutOfEffectReasonCode
|
||||
alias_attribute :when_last_changed, :WhenLastChanged
|
||||
alias_attribute :who_last_changed, :WhoLastChanged
|
||||
alias_attribute :user_defined_rate_criteria_value_1, :UserDefinedRateCriteriaValue1
|
||||
alias_attribute :user_defined_rate_criteria_value_2, :UserDefinedRateCriteriaValue2
|
||||
alias_attribute :user_defined_rate_criteria_value_3, :UserDefinedRateCriteriaValue3
|
||||
alias_attribute :user_defined_rate_criteria_record_id_1, :UserDefinedRateCriteriaRecordID1
|
||||
alias_attribute :user_defined_rate_criteria_record_id_2, :UserDefinedRateCriteriaRecordID2
|
||||
alias_attribute :user_defined_rate_criteria_record_id_3, :UserDefinedRateCriteriaRecordID3
|
||||
alias_attribute :optional_amount_record_id, :OptionalAmountRecordID
|
||||
alias_attribute :primary_pb_affiliation_key, :PrimaryPBAffiliationKey
|
||||
alias_attribute :payment_type_record_id_g_1_7_7, :PaymentTypeRecordID_G177
|
||||
|
||||
def attributes
|
||||
rails_like = {
|
||||
pb_product_participation_key: self.pb_product_participation_key,
|
||||
pb_affiliation_key: self.pb_affiliation_key,
|
||||
pb_product_availability_key: self.pb_product_availability_key,
|
||||
coverage_type_code: self.coverage_type_code,
|
||||
optional_amount: self.optional_amount,
|
||||
in_effect: self.in_effect,
|
||||
out_of_effect: self.out_of_effect,
|
||||
in_effect_reason_code: self.in_effect_reason_code,
|
||||
out_of_effect_reason_code: self.out_of_effect_reason_code,
|
||||
when_last_changed: self.when_last_changed,
|
||||
who_last_changed: self.who_last_changed,
|
||||
user_defined_rate_criteria_value_1: self.user_defined_rate_criteria_value_1,
|
||||
user_defined_rate_criteria_value_2: self.user_defined_rate_criteria_value_2,
|
||||
user_defined_rate_criteria_value_3: self.user_defined_rate_criteria_value_3,
|
||||
user_defined_rate_criteria_record_id_1: self.user_defined_rate_criteria_record_id_1,
|
||||
user_defined_rate_criteria_record_id_2: self.user_defined_rate_criteria_record_id_2,
|
||||
user_defined_rate_criteria_record_id_3: self.user_defined_rate_criteria_record_id_3,
|
||||
optional_amount_record_id: self.optional_amount_record_id,
|
||||
primary_pb_affiliation_key: self.primary_pb_affiliation_key,
|
||||
payment_type_record_id_g_1_7_7: self.payment_type_record_id_g_1_7_7,
|
||||
}
|
||||
super.merge(rails_like)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,103 @@
|
||||
module Vhcs
|
||||
class VwmbMember < VhcsRecord
|
||||
|
||||
self.table_name = 'VWMBMember'
|
||||
|
||||
alias_attribute :mb_member_key, :MBMemberKey
|
||||
alias_attribute :pb_entity_key, :PBEntityKey
|
||||
alias_attribute :pl_plan_key, :PLPlanKey
|
||||
alias_attribute :mbr_class, :MbrClass
|
||||
alias_attribute :mbr_type, :MbrType
|
||||
alias_attribute :mbr_ap_vendor_key, :MbrAPVendorKey
|
||||
alias_attribute :alt_ap_vendor_key, :AltAPVendorKey
|
||||
alias_attribute :use_alt_payee, :UseAltPayee
|
||||
alias_attribute :send_eob_primary, :SendEOBPrimary
|
||||
alias_attribute :send_eob_dependent, :SendEOBDependent
|
||||
alias_attribute :send_eob_third_party, :SendEOBThirdParty
|
||||
alias_attribute :student_flag, :StudentFlag
|
||||
alias_attribute :disabled_dependent_flag, :DisabledDependentFlag
|
||||
alias_attribute :is_restricted, :IsRestricted
|
||||
alias_attribute :third_party_pb_entity_key, :ThirdPartyPBEntityKey
|
||||
alias_attribute :user_def_1, :UserDef1
|
||||
alias_attribute :user_def_2, :UserDef2
|
||||
alias_attribute :family_id, :FamilyID
|
||||
alias_attribute :sequence_number, :SequenceNumber
|
||||
alias_attribute :enrollee_type_key, :EnrolleeTypeKey
|
||||
alias_attribute :enrollee_type, :EnrolleeType
|
||||
alias_attribute :enrollee_type_value_id, :EnrolleeTypeValueID
|
||||
alias_attribute :sex_key, :SexKey
|
||||
alias_attribute :use_primary_address, :UsePrimaryAddress
|
||||
alias_attribute :birth_date, :BirthDate
|
||||
alias_attribute :birth_sequence_number, :BirthSequenceNumber
|
||||
alias_attribute :death_date, :DeathDate
|
||||
alias_attribute :date_of_birth, :DateOfBirth
|
||||
alias_attribute :date_of_death, :DateOfDeath
|
||||
alias_attribute :social_security_number, :SocialSecurityNumber
|
||||
alias_attribute :hipaaid, :HIPAAID
|
||||
alias_attribute :company_pb_entity_key, :CompanyPBEntityKey
|
||||
alias_attribute :entity_type_id, :EntityTypeID
|
||||
alias_attribute :prefix_id, :PrefixID
|
||||
alias_attribute :first_name, :FirstName
|
||||
alias_attribute :middle_name, :MiddleName
|
||||
alias_attribute :last_name, :LastName
|
||||
alias_attribute :suffix_id, :SuffixID
|
||||
alias_attribute :title, :Title
|
||||
alias_attribute :letter_tag_bit_flags, :LetterTagBitFlags
|
||||
alias_attribute :full_name_last_name_first, :FullNameLastNameFirst
|
||||
alias_attribute :policy_number, :PolicyNumber
|
||||
alias_attribute :send_eob_alt_payee, :SendEOBAltPayee
|
||||
alias_attribute :send_eob_alt_payee_only, :SendEOBAltPayeeOnly
|
||||
|
||||
def attributes
|
||||
rails_like = {
|
||||
mb_member_key: self.mb_member_key,
|
||||
pb_entity_key: self.pb_entity_key,
|
||||
pl_plan_key: self.pl_plan_key,
|
||||
mbr_class: self.mbr_class,
|
||||
mbr_type: self.mbr_type,
|
||||
mbr_ap_vendor_key: self.mbr_ap_vendor_key,
|
||||
alt_ap_vendor_key: self.alt_ap_vendor_key,
|
||||
use_alt_payee: self.use_alt_payee,
|
||||
send_eob_primary: self.send_eob_primary,
|
||||
send_eob_dependent: self.send_eob_dependent,
|
||||
send_eob_third_party: self.send_eob_third_party,
|
||||
student_flag: self.student_flag,
|
||||
disabled_dependent_flag: self.disabled_dependent_flag,
|
||||
is_restricted: self.is_restricted,
|
||||
third_party_pb_entity_key: self.third_party_pb_entity_key,
|
||||
user_def_1: self.user_def_1,
|
||||
user_def_2: self.user_def_2,
|
||||
family_id: self.family_id,
|
||||
sequence_number: self.sequence_number,
|
||||
enrollee_type_key: self.enrollee_type_key,
|
||||
enrollee_type: self.enrollee_type,
|
||||
enrollee_type_value_id: self.enrollee_type_value_id,
|
||||
sex_key: self.sex_key,
|
||||
use_primary_address: self.use_primary_address,
|
||||
birth_date: self.birth_date,
|
||||
birth_sequence_number: self.birth_sequence_number,
|
||||
death_date: self.death_date,
|
||||
date_of_birth: self.date_of_birth,
|
||||
date_of_death: self.date_of_death,
|
||||
social_security_number: self.social_security_number,
|
||||
hipaaid: self.hipaaid,
|
||||
company_pb_entity_key: self.company_pb_entity_key,
|
||||
entity_type_id: self.entity_type_id,
|
||||
prefix_id: self.prefix_id,
|
||||
first_name: self.first_name,
|
||||
middle_name: self.middle_name,
|
||||
last_name: self.last_name,
|
||||
suffix_id: self.suffix_id,
|
||||
title: self.title,
|
||||
letter_tag_bit_flags: self.letter_tag_bit_flags,
|
||||
full_name_last_name_first: self.full_name_last_name_first,
|
||||
policy_number: self.policy_number,
|
||||
send_eob_alt_payee: self.send_eob_alt_payee,
|
||||
send_eob_alt_payee_only: self.send_eob_alt_payee_only,
|
||||
}
|
||||
super.merge(rails_like)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class VhcsRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
connects_to database: { writing: :vhcs, reading: :vhcs }
|
||||
end
|
||||
@@ -0,0 +1,72 @@
|
||||
module BenefitsWordDoc
|
||||
class MapEmployerInformation
|
||||
|
||||
def initialize(employer, word_doc_section)
|
||||
@employer = employer
|
||||
@word_doc_section = word_doc_section
|
||||
end
|
||||
|
||||
def call
|
||||
search_fields = mapping_hash.keys.to_set
|
||||
|
||||
@word_doc_section.each do |line|
|
||||
matching_field = search_fields.detect { |field| line.include?(field) }
|
||||
if matching_field
|
||||
field_mapping = mapping_hash[matching_field]
|
||||
field_regex = field_mapping[:doc_to_employer_regex]
|
||||
field_value = line.match(field_regex)[1].strip
|
||||
employer_field = field_mapping[:employer_field]
|
||||
|
||||
if field_mapping[:validation].present?
|
||||
validation_type = field_mapping[:validation]
|
||||
if send("is_#{validation_type}?".to_sym, field_value)
|
||||
@employer[employer_field] = field_value
|
||||
end
|
||||
else
|
||||
@employer[employer_field] = field_value
|
||||
end
|
||||
end
|
||||
end
|
||||
@employer
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def mapping_hash
|
||||
{
|
||||
'Employer Name' => {
|
||||
employer_field: :name,
|
||||
doc_field: 'Employer Name',
|
||||
doc_field_desc: 'Follows pattern - Employer Name:New Employer',
|
||||
doc_to_employer_regex: /.*:(.*)/,
|
||||
regex_desc: 'Grabs everything after colon'
|
||||
},
|
||||
'Group Number' => {
|
||||
employer_field: :group_number,
|
||||
doc_field: 'Group Number',
|
||||
doc_field_desc: 'Follows pattern - Group Number:099999',
|
||||
doc_to_employer_regex: /.*:(.*)/,
|
||||
regex_desc: 'Grabs everything after colon',
|
||||
validation: 'number'
|
||||
},
|
||||
'Group Effective Date' => {
|
||||
employer_field: :effective_date,
|
||||
doc_field: 'Group Effective Date',
|
||||
doc_field_desc: 'Follows pattern - Group Effective Date:12/1/2025',
|
||||
doc_to_employer_regex: /.*:(.*)/,
|
||||
regex_desc: 'Grabs everything after colon',
|
||||
validation: 'date'
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def is_number?(string)
|
||||
true if Float(string) rescue false
|
||||
end
|
||||
|
||||
def is_date?(string)
|
||||
true if Date.parse rescue false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,78 @@
|
||||
module BenefitsWordDoc
|
||||
class MapEmployerLogo
|
||||
|
||||
def initialize(employer, word_doc)
|
||||
@employer = employer
|
||||
@word_doc = word_doc
|
||||
end
|
||||
|
||||
def call
|
||||
Zip::File.open(@word_doc) do |zip_file|
|
||||
media_files = zip_file.select { |entry| entry.name.start_with?('word/media/') && !entry.directory? }
|
||||
|
||||
if media_files.length > 1
|
||||
logo = media_files.last
|
||||
file_extension = File.extname(logo.name)
|
||||
meme_type = Marcel::MimeType.for(logo.get_input_stream)
|
||||
image_binary = logo.get_input_stream.read
|
||||
# image_binary = File.binread(logo.get_input_stream.read)
|
||||
|
||||
filename = @employer.name_to_logo_filename(file_extension)
|
||||
|
||||
logo = CardLogoFile.find_or_create_by(filename: filename) do |clf|
|
||||
clf.image_data = image_binary
|
||||
clf.content_type = meme_type
|
||||
clf.logo_type = "employer"
|
||||
end
|
||||
|
||||
# new_logo = CardLogoFile.create!(
|
||||
# filename: filename,
|
||||
# image_data: image_binary,
|
||||
# content_type: meme_type,
|
||||
# logo_type: "employer"
|
||||
# )
|
||||
|
||||
image_io = StringIO.new(image_binary)
|
||||
width, height = FastImage.size(image_io)
|
||||
image_ratio = width.to_f / height
|
||||
if (0.8..1.2).cover?(image_ratio)
|
||||
@employer.single_card_template = "FairosRxIDCard-Half"
|
||||
else
|
||||
@employer.single_card_template = "FairosRxIDCard"
|
||||
end
|
||||
|
||||
@employer.employer_logo_filename = logo.filename
|
||||
end
|
||||
end
|
||||
@employer
|
||||
end
|
||||
|
||||
# def call
|
||||
# extracted_images = []
|
||||
# Zip::File.open(@word_doc) do |zip_file|
|
||||
# zip_file.each do |entry|
|
||||
# if entry.name.start_with?('word/media/') && !entry.directory?
|
||||
# file_extension = File.extname(entry.name)
|
||||
# image_data = entry.get_input_stream.read
|
||||
# extracted_images << { file_extension: file_extension, data: image_data }
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# if extracted_images.length > 1
|
||||
# logo = extracted_images.last
|
||||
# filename = @employer.employer_name_to_logo_filename(logo[:file_extension])
|
||||
# employer_logo_binary = logo[:data]
|
||||
|
||||
# new_logo = @employer.card_logo_files.create(
|
||||
# filename: filename,
|
||||
# image: employer_logo_binary,
|
||||
# logo_type: "employer"
|
||||
# )
|
||||
|
||||
# @employer.employer_logo = new_logo.filename
|
||||
# # same file logic
|
||||
# end
|
||||
# @employer.save
|
||||
# end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,33 @@
|
||||
module BenefitsWordDoc
|
||||
class MapNetworkInformation
|
||||
|
||||
def initialize(employer, word_doc_section)
|
||||
@employer = employer
|
||||
@word_doc_section = word_doc_section
|
||||
end
|
||||
|
||||
def call
|
||||
network_matches = []
|
||||
@word_doc_section.each do |line|
|
||||
if network_matches.exclude?("Cigna") && line.match?(/cigna/i)
|
||||
network_matches.push("Cigna")
|
||||
elsif network_matches.exclude?("Medcost") && line.match?(/medcost/i)
|
||||
network_matches.push("Medcost")
|
||||
end
|
||||
end
|
||||
|
||||
if network_matches.length == 1
|
||||
network_provider = network_matches.first
|
||||
@employer.network_provider = network_provider
|
||||
@employer.default_network_logo = "#{network_provider}Logo.png"
|
||||
provider_code = network_provider == "Cigna" ? "5" : "2"
|
||||
@employer.card_provider = CardProvider.find_by(provider_code: provider_code)
|
||||
@employer.card_rx = CardRx.find_by(web_url: "www.FairosRx.com")
|
||||
end
|
||||
|
||||
|
||||
@employer
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,273 @@
|
||||
module BenefitsWordDoc
|
||||
class MapPlansInformation
|
||||
|
||||
def initialize(employer, word_doc_section)
|
||||
@employer = employer
|
||||
@word_doc_section = word_doc_section
|
||||
end
|
||||
|
||||
def call
|
||||
search_fields = mapping_hash.keys.to_set
|
||||
plans_indexes = @word_doc_section.each_index.select { |index| @word_doc_section[index].match?(/\d*\.?\d+k/i) }
|
||||
|
||||
plans_indexes.each do |plan_index|
|
||||
new_plan = @employer.build_plan_with_default_benefits(title: @word_doc_section[plan_index])
|
||||
plan_lines = @word_doc_section.slice(plan_index + 1, 14)
|
||||
plan_lines.each_with_index do |line, i|
|
||||
field_mapping = mapping_array[i]
|
||||
field_regex = field_mapping[:doc_to_employer_regex]
|
||||
if line.match(field_regex)
|
||||
field_value = line.match(field_regex)[0].strip
|
||||
elsif line.match(default_benefit_regex(field_mapping[:employer_benefit_desc_field]))
|
||||
field_value = line.match(default_benefit_regex(field_mapping[:employer_benefit_desc_field]))[0].strip
|
||||
else
|
||||
field_value = line
|
||||
end
|
||||
employer_benefit_desc_field = field_mapping[:employer_benefit_desc_field]
|
||||
new_benefit = new_plan.plan_benefits[i]
|
||||
new_benefit.benefit = field_value
|
||||
|
||||
|
||||
# matching_field = search_fields.detect { |field| line.include?(field) }
|
||||
# if matching_field
|
||||
# field_mapping = mapping_hash[matching_field]
|
||||
# field_regex = field_mapping[:doc_to_employer_regex]
|
||||
# if line.match(field_regex)
|
||||
# field_value = line.match(field_regex)[0].strip
|
||||
# elsif line.match(default_benefit_regex(field_mapping[:employer_benefit_desc_field]))
|
||||
# field_value = line.match(default_benefit_regex(field_mapping[:employer_benefit_desc_field]))[0].strip
|
||||
# else
|
||||
# field_value = ""
|
||||
# end
|
||||
# employer_benefit_desc_field = field_mapping[:employer_benefit_desc_field]
|
||||
# new_benefit = new_plan.plan_benefits.find_by(benefit_desc: employer_benefit_desc_field)
|
||||
# new_benefit.benefit = field_value
|
||||
# new_benefit.save
|
||||
# end
|
||||
end
|
||||
end
|
||||
@employer
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def mapping_array
|
||||
[
|
||||
{
|
||||
employer_benefit_sequence: 1,
|
||||
employer_benefit_desc_field: 'Primary Visit',
|
||||
doc_field_desc: 'Follows pattern - Physician Visit$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
{
|
||||
employer_benefit_sequence: 2,
|
||||
employer_benefit_desc_field: 'Specialist Visit',
|
||||
doc_field_desc: 'Follows pattern - Specialist Visit$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
{
|
||||
employer_benefit_sequence: 3,
|
||||
employer_benefit_desc_field: 'Urgent Care',
|
||||
doc_field_desc: 'Follows pattern - Urgent Care$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
{
|
||||
employer_benefit_sequence: 4,
|
||||
employer_benefit_desc_field: 'INN–Ind Ded',
|
||||
doc_field_desc: 'Follows pattern - Individual Deductible (in network )$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
{
|
||||
employer_benefit_sequence: 5,
|
||||
employer_benefit_desc_field: 'INN–Family Ded',
|
||||
doc_field_desc: 'Follows pattern - Family Deductible(in network )$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
{
|
||||
employer_benefit_sequence: 6,
|
||||
employer_benefit_desc_field: 'OON–Ind Ded',
|
||||
doc_field_desc: 'Follows pattern - Individual Deductible (out of network)$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
{
|
||||
employer_benefit_sequence: 7,
|
||||
employer_benefit_desc_field: 'OON–Family Ded',
|
||||
doc_field_desc: 'Follows pattern - Family Deductible (out of network)$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
{
|
||||
employer_benefit_sequence: 8,
|
||||
employer_benefit_desc_field: 'Co-Insurance',
|
||||
doc_field_desc: 'Follows pattern - Co-Insurance70%/30%',
|
||||
doc_to_employer_regex: /(?<=Co-Insurance).*/,
|
||||
regex_desc: 'Grabs everything after field name'
|
||||
},
|
||||
{
|
||||
employer_benefit_sequence: 9,
|
||||
employer_benefit_desc_field: 'INN–Ind OOP',
|
||||
doc_field_desc: 'Follows pattern - Out-of-Pocket(in network)$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
{
|
||||
employer_benefit_sequence: 10,
|
||||
employer_benefit_desc_field: 'INN–Family OOP',
|
||||
doc_field_desc: 'Follows pattern - Out-of-Pocket Family(in network)$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
{
|
||||
employer_benefit_sequence: 11,
|
||||
employer_benefit_desc_field: 'OON–Ind OOP',
|
||||
doc_field_desc: 'Follows pattern - Out-of-Pocket(out of network)$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
{
|
||||
employer_benefit_sequence: 12,
|
||||
employer_benefit_desc_field: 'OON–Family OOP',
|
||||
doc_field_desc: 'Follows pattern - Out-of-Pocket Family (out of network)$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
{
|
||||
employer_benefit_sequence: 13,
|
||||
employer_benefit_desc_field: 'Emergency Room',
|
||||
doc_field_desc: 'Follows pattern - Emergency RoomXxxxx',
|
||||
doc_to_employer_regex: /(?<=Emergency Room).*/,
|
||||
regex_desc: 'Grabs everything after field name'
|
||||
},
|
||||
{
|
||||
employer_benefit_sequence: 14,
|
||||
employer_benefit_desc_field: 'Preventive Care',
|
||||
doc_field_desc: 'Follows pattern - Preventive Care100%',
|
||||
doc_to_employer_regex: /(?<=Preventive Care).*/,
|
||||
regex_desc: 'Grabs everything after field name'
|
||||
}
|
||||
]
|
||||
end
|
||||
|
||||
def mapping_hash
|
||||
{
|
||||
'Physician Visit' => {
|
||||
employer_benefit_sequence: 1,
|
||||
employer_benefit_desc_field: 'Primary Visit',
|
||||
doc_field_desc: 'Follows pattern - Physician Visit$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
'Specialist Visit' => {
|
||||
employer_benefit_sequence: 2,
|
||||
employer_benefit_desc_field: 'Specialist Visit',
|
||||
doc_field_desc: 'Follows pattern - Specialist Visit$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
'Urgent Care' => {
|
||||
employer_benefit_sequence: 3,
|
||||
employer_benefit_desc_field: 'Urgent Care',
|
||||
doc_field_desc: 'Follows pattern - Urgent Care$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
'Individual Deductible' => {
|
||||
employer_benefit_sequence: 4,
|
||||
employer_benefit_desc_field: 'INN–Ind Ded',
|
||||
doc_field_desc: 'Follows pattern - Individual Deductible (in network )$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
'Family Deductible' => {
|
||||
employer_benefit_sequence: 5,
|
||||
employer_benefit_desc_field: 'INN–Family Ded',
|
||||
doc_field_desc: 'Follows pattern - Family Deductible(in network )$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
'Individual Deductible' => {
|
||||
employer_benefit_sequence: 6,
|
||||
employer_benefit_desc_field: 'OON–Ind Ded',
|
||||
doc_field_desc: 'Follows pattern - Individual Deductible (out of network)$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
'Family Deductible' => {
|
||||
employer_benefit_sequence: 7,
|
||||
employer_benefit_desc_field: 'OON–Family Ded',
|
||||
doc_field_desc: 'Follows pattern - Family Deductible (out of network)$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
'Co-Insurance' => {
|
||||
employer_benefit_sequence: 8,
|
||||
employer_benefit_desc_field: 'Co-Insurance',
|
||||
doc_field_desc: 'Follows pattern - Co-Insurance70%/30%',
|
||||
doc_to_employer_regex: /(?<=Co-Insurance).*/,
|
||||
regex_desc: 'Grabs everything after field name'
|
||||
},
|
||||
'Out-of-Pocket' => {
|
||||
employer_benefit_sequence: 9,
|
||||
employer_benefit_desc_field: 'INN–Ind OOP',
|
||||
doc_field_desc: 'Follows pattern - Out-of-Pocket(in network)$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
'Out-of-Pocket Family' => {
|
||||
employer_benefit_sequence: 10,
|
||||
employer_benefit_desc_field: 'INN–Family OOP',
|
||||
doc_field_desc: 'Follows pattern - Out-of-Pocket Family(in network)$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
'Out-of-Pocket' => {
|
||||
employer_benefit_sequence: 11,
|
||||
employer_benefit_desc_field: 'OON–Ind OOP',
|
||||
doc_field_desc: 'Follows pattern - Out-of-Pocket(out of network)$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
'Out-of-Pocket Family' => {
|
||||
employer_benefit_sequence: 12,
|
||||
employer_benefit_desc_field: 'OON–Family OOP',
|
||||
doc_field_desc: 'Follows pattern - Out-of-Pocket Family (out of network)$x,xxx',
|
||||
doc_to_employer_regex: /\$.*/,
|
||||
regex_desc: 'Grabs dollar sign and everything after'
|
||||
},
|
||||
'Emergency Room' => {
|
||||
employer_benefit_sequence: 13,
|
||||
employer_benefit_desc_field: 'Emergency Room',
|
||||
doc_field_desc: 'Follows pattern - Emergency RoomXxxxx',
|
||||
doc_to_employer_regex: /(?<=Emergency Room).*/,
|
||||
regex_desc: 'Grabs everything after field name'
|
||||
},
|
||||
'Preventive Care' => {
|
||||
employer_benefit_sequence: 14,
|
||||
employer_benefit_desc_field: 'Preventive Care',
|
||||
doc_field_desc: 'Follows pattern - Preventive Care100%',
|
||||
doc_to_employer_regex: /(?<=Preventive Care).*/,
|
||||
regex_desc: 'Grabs everything after field name'
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
def default_benefit_regex(field)
|
||||
/(?<=#{field}).*/
|
||||
end
|
||||
|
||||
def is_number?(string)
|
||||
true if Float(string) rescue false
|
||||
end
|
||||
|
||||
def is_date?(string)
|
||||
true if Date.parse rescue false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,32 @@
|
||||
class BenefitsWordDocProcessor
|
||||
|
||||
def initialize(word_doc, employer=nil)
|
||||
@word_doc = word_doc
|
||||
if employer
|
||||
@employer = employer
|
||||
else
|
||||
@employer = Employer.new
|
||||
end
|
||||
end
|
||||
|
||||
def call
|
||||
doc = Docx::Document.open(@word_doc)
|
||||
data_lines = doc.paragraphs.map { |p| p.to_s.squish }.reject!(&:empty?)
|
||||
|
||||
employer_information, plans_and_network = data_lines.split("Medical Plan")
|
||||
plan_information, network_information = plans_and_network.split("Claims Submission")
|
||||
|
||||
# employer_information = data_lines.slice(0, start_of_plans_index)
|
||||
# plan_information = data_lines.slice(start_of_plans_index + 1..)
|
||||
# network_information = data_lines.slice(start_of_network_index + 1..)
|
||||
|
||||
@employer = BenefitsWordDoc::MapEmployerInformation.new(@employer, employer_information).call
|
||||
@employer = BenefitsWordDoc::MapEmployerLogo.new(@employer, @word_doc).call
|
||||
@employer = BenefitsWordDoc::MapPlansInformation.new(@employer, plan_information).call
|
||||
@employer = BenefitsWordDoc::MapNetworkInformation.new(@employer, network_information).call
|
||||
|
||||
@employer
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,163 @@
|
||||
class BenefitsWordDocProcessorOld
|
||||
|
||||
def initialize(word_doc, process=nil)
|
||||
@word_doc = word_doc
|
||||
if process
|
||||
@process = process
|
||||
else
|
||||
@process = EmployerSetupProcess.new
|
||||
end
|
||||
end
|
||||
|
||||
def call
|
||||
doc = Docx::Document.open(@word_doc)
|
||||
|
||||
index = 40
|
||||
|
||||
general_information = doc.paragraphs.slice(0, index)
|
||||
plan_information = doc.paragraphs.slice(index + 1..)
|
||||
|
||||
|
||||
general_fields(general_information)
|
||||
plans(plan_information)
|
||||
employer_logo()
|
||||
|
||||
@process
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def general_fields(general_information)
|
||||
fields = ['Group Number:', 'Employer Name:', 'Group Effective Date:']
|
||||
general_information.each do |gi|
|
||||
field_string = gi.to_s
|
||||
if field_string.include?('Group Number:')
|
||||
value = field_string.delete_prefix('Group Number:').strip
|
||||
if is_number?(value)
|
||||
@process.group_number = value
|
||||
end
|
||||
elsif field_string.include?('Employer Name:')
|
||||
value = field_string.delete_prefix('Employer Name:').strip
|
||||
@process.name = value
|
||||
elsif field_string.include?('Group Effective Date:')
|
||||
value = field_string.delete_prefix('Group Effective Date:').strip
|
||||
@process.effective_date = value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def employer_logo
|
||||
extracted_images = []
|
||||
Zip::File.open(@word_doc) do |zip_file|
|
||||
zip_file.each do |entry|
|
||||
if entry.name.start_with?('word/media/') && !entry.directory?
|
||||
filename = File.basename(entry.name)
|
||||
image_data = entry.get_input_stream.read
|
||||
extracted_images << { filename: filename, data: image_data }
|
||||
end
|
||||
end
|
||||
end
|
||||
if extracted_images.length > 1
|
||||
@process.employer_logo = @process.name.titleize.gsub(/\s+/, '').concat("Logo.png")
|
||||
# same file logic
|
||||
end
|
||||
end
|
||||
|
||||
def plans(plan_information)
|
||||
plans_array = []
|
||||
plan_information.each_with_index do |pin, i|
|
||||
if pin.to_s.match?(/\d*\.?\d+k/i)
|
||||
new_plan = {title: pin.to_s.strip, start_index: i, benefits: []}
|
||||
plans_array.push(new_plan)
|
||||
end
|
||||
end
|
||||
|
||||
plans_array.each do |pl|
|
||||
new_plan = Plan.create(title: pl[:title], employer_setup_process: @process)
|
||||
plan_fields = plan_information.slice(pl[:start_index] + 1, 14)
|
||||
plan_fields.each_with_index do |pf, i|
|
||||
field_string = pf.to_s
|
||||
if field_string.strip.length > 1
|
||||
case field_string
|
||||
when ->(string) { string.include?("Physician Visit") }
|
||||
value = field_string.delete_prefix("Physician Visit")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Primary Visit")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Specialist Visit") }
|
||||
value = field_string.delete_prefix("Specialist Visit")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Specialist Visit")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Urgent Care") }
|
||||
value = field_string.delete_prefix("Urgent Care")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Urgent Care")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Individual Deductible (in network )") }
|
||||
value = field_string.delete_prefix("Individual Deductible (in network )")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "INN–Ind Ded")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Family Deductible(in network )") }
|
||||
value = field_string.delete_prefix("Family Deductible(in network )")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "INN–Family Ded")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Individual Deductible (out of network)") }
|
||||
value = field_string.delete_prefix("Individual Deductible (out of network)")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "OON–Ind Ded")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Family Deductible (out of network) ") }
|
||||
value = field_string.delete_prefix("Family Deductible (out of network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "OON–Family Ded")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Co-Insurance") }
|
||||
value = field_string.delete_prefix("Co-Insurance")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Co-Insurance")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Out-of-Pocket(in network) ") }
|
||||
value = field_string.delete_prefix("Out-of-Pocket(in network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "INN–Ind OOP")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Out-of-Pocket Family(in network) ") }
|
||||
value = field_string.delete_prefix("Out-of-Pocket Family(in network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "INN–Family OOP")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Out-of-Pocket(out of network) ") }
|
||||
value = field_string.delete_prefix("Out-of-Pocket(out of network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "OON–Ind OOP")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Out-of-Pocket Family (out of network) ") }
|
||||
value = field_string.delete_prefix("Out-of-Pocket Family (out of network) ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "OON–Family OOP")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Emergency Room ") }
|
||||
value = field_string.delete_prefix("Emergency Room ")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Emergency Room")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
when ->(string) { string.include?("Preventive Care") }
|
||||
value = field_string.delete_prefix("Preventive Care")
|
||||
new_benefit = new_plan.plan_benefits.find_by(benefit_desc: "Preventive Care")
|
||||
new_benefit.benefit = value
|
||||
new_benefit.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def is_number?(string)
|
||||
true if Float(string) rescue false
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,121 @@
|
||||
module EmployerCards
|
||||
class DataFormatter
|
||||
|
||||
def initialize(employer)
|
||||
@employer = employer
|
||||
end
|
||||
|
||||
def call
|
||||
@members = @employer.members
|
||||
@employer_cards = []
|
||||
|
||||
init_cards_and_set_member_fields
|
||||
set_plan_fields
|
||||
set_common_fields
|
||||
|
||||
@employer_cards.each(&:save!)
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_common_fields
|
||||
employer_attributes = {
|
||||
employer_name: @employer.id_card_display_name,
|
||||
group_number: @employer.group_number,
|
||||
rx_group: @employer.rx_group_number
|
||||
}
|
||||
|
||||
rx_attributes = @employer.card_rx.attributes.with_indifferent_access.slice(
|
||||
:customer_service,
|
||||
:web_url
|
||||
)
|
||||
|
||||
provider_attributes = @employer.card_provider.attributes.with_indifferent_access.slice(
|
||||
: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, :provider_line_12,
|
||||
: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, :claim_to_12
|
||||
)
|
||||
|
||||
selected_attributes = employer_attributes.merge(rx_attributes).merge(provider_attributes)
|
||||
@employer_cards.each do |card|
|
||||
card.assign_attributes(selected_attributes)
|
||||
end
|
||||
end
|
||||
|
||||
def set_plan_fields
|
||||
@employer.plans.each do |plan|
|
||||
selected_attributes = {}
|
||||
plan.plan_benefits.each do |bene|
|
||||
selected_attributes["benefit_desc_#{bene.sequence}".to_sym] = bene.benefit_desc
|
||||
selected_attributes["benefit_#{bene.sequence}".to_sym] = bene.benefit
|
||||
end
|
||||
@employer_cards.find_all { |card| card.plan_id == plan.id.to_s }.each do |card|
|
||||
card.assign_attributes(selected_attributes)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def init_cards_and_set_member_fields
|
||||
@members.each do |me|
|
||||
effect_date = determine_eff_date(me)
|
||||
if effect_date
|
||||
member_card = SampleIdCard.new()
|
||||
selected_attributes = {
|
||||
full_name: me.id_card_display_name,
|
||||
primary_mb_member_key: me.mb_member_key,
|
||||
family_id: me.family_id,
|
||||
plan_id: me.plan_id,
|
||||
medical_eff_date: effect_date.strftime("%m/%d/%Y")
|
||||
|
||||
}
|
||||
|
||||
member_card.assign_attributes(selected_attributes)
|
||||
@employer_cards.push(member_card)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# def set_network_fields
|
||||
# selected_attributes = @employer.card_provider.attributes.with_indifferent_access.slice(
|
||||
# :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, :provider_line_12,
|
||||
# :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, :claim_to_12
|
||||
# )
|
||||
# @employer_cards.all do |card|
|
||||
# card.assign_attributes(selected_attributes)
|
||||
# end
|
||||
# end
|
||||
|
||||
# def set_rx_fields
|
||||
# # fairos_information = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first
|
||||
# selected_attributes = @employer.card_rx.attributes.with_indifferent_access.slice(
|
||||
# :customer_service,
|
||||
# :web_url
|
||||
# )
|
||||
# @employer_cards.all do |card|
|
||||
# card.assign_attributes(selected_attributes)
|
||||
# end
|
||||
# end
|
||||
|
||||
def determine_eff_date(member)
|
||||
|
||||
participation = Vhcs::PbProductParticipation.joins('INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"').where('"PBCoveredEntities"."PBEntityKey" = ?', member.pb_entity_key).first
|
||||
in_effect = participation.in_effect
|
||||
out_of_effect = participation.out_of_effect
|
||||
|
||||
if in_effect <= (Date.today + 90.days) && (out_of_effect - 1.day) > Date.today && out_of_effect > in_effect
|
||||
in_effect
|
||||
else
|
||||
false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def set_dependent_fields
|
||||
# Not needed for sample card
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,48 @@
|
||||
module EmployerCards
|
||||
class JasperUrlGenerator
|
||||
|
||||
def initialize(employer, family_id)
|
||||
@family_id = family_id
|
||||
@employer = employer
|
||||
end
|
||||
|
||||
def call
|
||||
# @net_logo = determine_network_logo
|
||||
card_front_url = URI::HTTP.build(url_components("Front"))
|
||||
card_back_url = URI::HTTP.build(url_components("Back"))
|
||||
|
||||
[card_front_url, card_back_url]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def determine_network_logo
|
||||
# if @network_logos.length > 1
|
||||
# member_geographic_info = Vhcs::PbEntityAddress.joins("INNER JOIN vwMBMember ON PBEntityAddress.PBEntityKey = vwMBMember.PBEntityKey AND PBEntityAddress.AddressTypeID = 1137").where("vwMBMember.FamilyID = ?", @family_id).first
|
||||
# @network_logos.where.not(default: true).each do |pnl|
|
||||
# if member_geographic_info[pnl.exception_type] == pnl.exception_value
|
||||
# return pnl.net_logo
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# @network_logos.find_by(default: true).net_logo
|
||||
@employer.default_network_logo
|
||||
end
|
||||
# http://localhost:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxSampleIDCard-Half&family_id=Classic%202K&employer_logo=BryanPestControl.jpeg&network_logo=CignaLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF
|
||||
# http://localhost:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxSampleIDCard-Half&family_id=Classic%202K&employer_logo=BryanPestControl.jpeg&network_logo=CignaLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF
|
||||
def url_components(card_side)
|
||||
if card_side == "Back" && @employer.single_card_template.include?("-Half")
|
||||
template = @employer.single_card_template.gsub("-Half", "")
|
||||
else
|
||||
template = @employer.single_card_template
|
||||
end
|
||||
{
|
||||
host: '10.41.1.115',
|
||||
port: 8080,
|
||||
path: '/trunk/PdfServlet',
|
||||
query: "reportConn=BrittonConnect&id=&reportName=#{template}-#{card_side}-Print&family_id=#{@family_id}&employer_logo=#{@employer.employer_logo_filename}&network_logo=#{determine_network_logo}&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF"
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,28 @@
|
||||
class EmployerCardsGenerator
|
||||
|
||||
def initialize(employer)
|
||||
@employer = employer
|
||||
end
|
||||
|
||||
def call
|
||||
SampleIdCard.where(employer_name: @employer.id_card_display_name).destroy_all
|
||||
EmployerCards::DataFormatter.new(@employer).call
|
||||
|
||||
group_cards_pdf = CombinePDF.new
|
||||
SampleIdCard.where(employer_name: @employer.id_card_display_name).each do |card|
|
||||
urls = EmployerCards::JasperUrlGenerator.new(@employer, card.family_id).call
|
||||
puts urls
|
||||
card_front_pdf = SampleCard::JasperPdfGenerator.new(urls.first).call
|
||||
card_back_pdf = SampleCard::JasperPdfGenerator.new(urls.last).call
|
||||
|
||||
group_cards_pdf << card_front_pdf
|
||||
group_cards_pdf << card_back_pdf
|
||||
end
|
||||
|
||||
# todays_date = DateTime.current.strftime('%Y%m%d%H%M%S')
|
||||
# group_cards_pdf.save("tmp/#{@employer.name}_print_cards_#{todays_date}.pdf")
|
||||
|
||||
group_cards_pdf
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,27 @@
|
||||
class ImageProcessor
|
||||
|
||||
def initialize(image_path, new_filename = nil)
|
||||
@image_path = image_path
|
||||
@new_filename = new_filename
|
||||
end
|
||||
|
||||
def call
|
||||
|
||||
if @new_filename
|
||||
filename = @new_filename
|
||||
else
|
||||
filename = File.basename(@image_path)
|
||||
end
|
||||
|
||||
binary_data = File.binread(@image_path)
|
||||
# binary_data = File.open(@image_path, 'rb').read
|
||||
meme_type = Marcel::MimeType.for Pathname.new(@image_path)
|
||||
|
||||
CardLogoFile.create(
|
||||
filename: filename,
|
||||
image_data: binary_data,
|
||||
content_type: meme_type,
|
||||
logo_type: "network"
|
||||
)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,81 @@
|
||||
module SampleCard
|
||||
class DataFormatter
|
||||
|
||||
def initialize(employer)
|
||||
@employer = employer
|
||||
end
|
||||
|
||||
def call
|
||||
@sample_card = SampleIdCard.new()
|
||||
|
||||
set_employer_fields()
|
||||
set_generic_fields()
|
||||
set_rx_fields()
|
||||
set_network_fields()
|
||||
sample_cards = set_plan_fields()
|
||||
sample_cards.each(&:save!)
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_employer_fields
|
||||
selected_attributes = {
|
||||
employer_name: @employer.name,
|
||||
group_number: @employer.group_number || "999999",
|
||||
medical_eff_date: @employer.effective_date
|
||||
}
|
||||
|
||||
@sample_card.assign_attributes(selected_attributes)
|
||||
end
|
||||
|
||||
def set_plan_fields
|
||||
plans_sample_cards = []
|
||||
@employer.plans.each do |plan|
|
||||
plan_sample_card = @sample_card.dup
|
||||
plan_sample_card.family_id = plan.title
|
||||
plan.plan_benefits.each do |bene|
|
||||
plan_sample_card["benefit_desc_#{bene.sequence}".to_sym] = bene.benefit_desc
|
||||
plan_sample_card["benefit_#{bene.sequence}".to_sym] = bene.benefit
|
||||
end
|
||||
plans_sample_cards.push(plan_sample_card)
|
||||
end
|
||||
plans_sample_cards
|
||||
end
|
||||
|
||||
def set_generic_fields
|
||||
selected_attributes = {
|
||||
full_name: "JANE DOE",
|
||||
primary_mb_member_key: "888888",
|
||||
rx_group: @employer.group_number || "999999"
|
||||
}
|
||||
|
||||
@sample_card.assign_attributes(selected_attributes)
|
||||
end
|
||||
|
||||
def set_network_fields
|
||||
selected_attributes = @employer.card_provider.attributes.with_indifferent_access.slice(
|
||||
: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, :provider_line_12,
|
||||
: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, :claim_to_12
|
||||
)
|
||||
|
||||
@sample_card.assign_attributes(selected_attributes)
|
||||
end
|
||||
|
||||
def set_rx_fields
|
||||
# fairos_information = Vhcs::HlrxCrosRef.where(pl_plan_key: 52).first
|
||||
selected_attributes = @employer.card_rx.attributes.with_indifferent_access.slice(
|
||||
:customer_service,
|
||||
:web_url
|
||||
)
|
||||
|
||||
@sample_card.assign_attributes(selected_attributes)
|
||||
end
|
||||
|
||||
def set_dependent_fields
|
||||
# Not needed for sample card
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
module SampleCard
|
||||
class JasperPdfGenerator
|
||||
|
||||
def initialize(jasper_url)
|
||||
@jasper_url = jasper_url
|
||||
end
|
||||
|
||||
|
||||
def call
|
||||
|
||||
response = HTTParty.get(@jasper_url)
|
||||
CombinePDF.parse(response.body)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
module SampleCard
|
||||
class JasperUrlGenerator
|
||||
|
||||
def initialize(employer, plan_name)
|
||||
@plan_name = plan_name
|
||||
@employer = employer
|
||||
end
|
||||
|
||||
def call
|
||||
# @net_logo = determine_network_logo
|
||||
|
||||
URI::HTTP.build(url_components)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def determine_card_template
|
||||
# if @network_logos.length > 1
|
||||
# member_geographic_info = Vhcs::PbEntityAddress.joins("INNER JOIN vwMBMember ON PBEntityAddress.PBEntityKey = vwMBMember.PBEntityKey AND PBEntityAddress.AddressTypeID = 1137").where("vwMBMember.FamilyID = ?", @family_id).first
|
||||
# @network_logos.where.not(default: true).each do |pnl|
|
||||
# if member_geographic_info[pnl.exception_type] == pnl.exception_value
|
||||
# return pnl.net_logo
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# @network_logos.find_by(default: true).net_logo
|
||||
if @employer.single_card_template.include?("Half")
|
||||
"FairosRxSampleIDCard-Half-Display"
|
||||
else
|
||||
"FairosRxSampleIDCard-Display"
|
||||
end
|
||||
end
|
||||
|
||||
def determine_network_logo
|
||||
# if @network_logos.length > 1
|
||||
# member_geographic_info = Vhcs::PbEntityAddress.joins("INNER JOIN vwMBMember ON PBEntityAddress.PBEntityKey = vwMBMember.PBEntityKey AND PBEntityAddress.AddressTypeID = 1137").where("vwMBMember.FamilyID = ?", @family_id).first
|
||||
# @network_logos.where.not(default: true).each do |pnl|
|
||||
# if member_geographic_info[pnl.exception_type] == pnl.exception_value
|
||||
# return pnl.net_logo
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# @network_logos.find_by(default: true).net_logo
|
||||
@employer.default_network_logo
|
||||
end
|
||||
# http://localhost:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxSampleIDCard-Half&family_id=Classic%202K&employer_logo=BryanPestControl.jpeg&network_logo=CignaLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF
|
||||
# http://localhost:8080/trunk/PdfServlet?reportConn=BrittonConnect&id=&reportName=FairosRxSampleIDCard-Half&family_id=Classic%202K&employer_logo=BryanPestControl.jpeg&network_logo=CignaLogo.png&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF
|
||||
def url_components
|
||||
{
|
||||
host: '10.41.1.115',
|
||||
port: 8080,
|
||||
path: '/trunk/PdfServlet',
|
||||
query: "reportConn=BrittonConnect&id=&reportName=#{determine_card_template}&family_id=#{@plan_name}&employer_logo=#{@employer.employer_logo_filename}&network_logo=#{determine_network_logo}&reportDir=secure/Documents&SUBREPORT_DIR=/&ImageDir=secure/Documents&netToken=3a4a8b03f4dfb0e6e3fc82dd369f70ef&FileType=PDF"
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,27 @@
|
||||
module SampleCard
|
||||
class PdfPrinter
|
||||
|
||||
def initialize(process, sample_cards)
|
||||
@process = process
|
||||
@sample_cards = sample_cards
|
||||
end
|
||||
|
||||
def call
|
||||
group_cards_pdf = CombinePDF.new
|
||||
@sample_cards.each do |sample_card|
|
||||
url = SampleCard::JasperUrlGenerator.new(@process, sample_card.family_id).call
|
||||
puts url
|
||||
sample_card_pdf = SampleCard::JasperPdfGenerator.new(url).call
|
||||
|
||||
group_cards_pdf << sample_card_pdf
|
||||
end
|
||||
|
||||
employer_name = @process.employer_name.downcase.tr(" ", "_")
|
||||
todays_date = Date.today.strftime("%m-%d-%Y")
|
||||
group_cards_pdf.save("tmp/#{employer_name}_sample_cards_#{todays_date}.pdf")
|
||||
|
||||
group_cards_pdf
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,23 @@
|
||||
class SampleCardGenerator
|
||||
|
||||
def initialize(employer)
|
||||
@employer = employer
|
||||
end
|
||||
|
||||
def call
|
||||
SampleIdCard.where(employer_name: @employer.name).destroy_all
|
||||
SampleCard::DataFormatter.new(@employer).call
|
||||
|
||||
group_sample_cards_pdf = CombinePDF.new
|
||||
SampleIdCard.where(employer_name: @employer.name).each do |card|
|
||||
url = SampleCard::JasperUrlGenerator.new(@employer, card.family_id).call
|
||||
puts url
|
||||
card_pdf = SampleCard::JasperPdfGenerator.new(url).call
|
||||
|
||||
group_sample_cards_pdf << card_pdf
|
||||
end
|
||||
|
||||
group_sample_cards_pdf
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,26 @@
|
||||
class SampleCardGeneratorLocal
|
||||
|
||||
def initialize(process)
|
||||
@process = process
|
||||
end
|
||||
|
||||
def call
|
||||
# SampleCard::DataFormatter.new(@process).call
|
||||
|
||||
group_sample_cards_pdf = CombinePDF.new
|
||||
SampleIdCard.where(employer_name: @process.employer_name).each do |card|
|
||||
url = SampleCard::JasperUrlGenerator.new(@process, card.family_id).call
|
||||
puts url
|
||||
card_pdf = SampleCard::JasperPdfGenerator.new(url).call
|
||||
|
||||
group_sample_cards_pdf << card_pdf
|
||||
end
|
||||
|
||||
|
||||
todays_date = DateTime.current.strftime('%Y%m%d%H%M%S')
|
||||
group_sample_cards_pdf.save("tmp/#{@process.employer_name}_sample_cards_#{todays_date}.pdf")
|
||||
|
||||
group_sample_cards_pdf
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
class ArrayOfItemsType < ActiveModel::Type::Value
|
||||
# The `cast` method is used to convert an incoming value into the desired type.
|
||||
def cast(value)
|
||||
return unless value.present?
|
||||
|
||||
Array.wrap(value).map do |item_data|
|
||||
# Assuming item_data is a hash, this creates an instance of the Item class.
|
||||
# You can modify this part to match your object's initializer.
|
||||
item_data # Return the item as-is if it's already an object
|
||||
end
|
||||
end
|
||||
|
||||
# This method is used when defining the type to convert it to a string for serialization.
|
||||
def serialize(value)
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
# ActiveModel::Type.register(:array_of_items, ArrayOfItemsType)
|
||||
@@ -0,0 +1,166 @@
|
||||
<div id="<%= dom_id card_provider %>" class="w-full sm:w-auto my-5 space-y-5">
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider code:</strong>
|
||||
<%= card_provider.provider_code %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider line 1:</strong>
|
||||
<%= card_provider.provider_line_1 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider line 2:</strong>
|
||||
<%= card_provider.provider_line_2 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider line 3:</strong>
|
||||
<%= card_provider.provider_line_3 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider line 4:</strong>
|
||||
<%= card_provider.provider_line_4 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider line 5:</strong>
|
||||
<%= card_provider.provider_line_5 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Mail to:</strong>
|
||||
<%= card_provider.mail_to %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Mail to 2:</strong>
|
||||
<%= card_provider.mail_to_2 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Contact line 1:</strong>
|
||||
<%= card_provider.contact_line_1 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Contact line 2:</strong>
|
||||
<%= card_provider.contact_line_2 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Contact line 3:</strong>
|
||||
<%= card_provider.contact_line_3 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Group number:</strong>
|
||||
<%= card_provider.group_number %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Claim to 1:</strong>
|
||||
<%= card_provider.claim_to_1 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Claim to 2:</strong>
|
||||
<%= card_provider.claim_to_2 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Claim to 3:</strong>
|
||||
<%= card_provider.claim_to_3 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Claim to 4:</strong>
|
||||
<%= card_provider.claim_to_4 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Claim to 5:</strong>
|
||||
<%= card_provider.claim_to_5 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Claim to 6:</strong>
|
||||
<%= card_provider.claim_to_6 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Claim to 7:</strong>
|
||||
<%= card_provider.claim_to_7 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Claim to 8:</strong>
|
||||
<%= card_provider.claim_to_8 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Claim to 9:</strong>
|
||||
<%= card_provider.claim_to_9 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Claim to 10:</strong>
|
||||
<%= card_provider.claim_to_10 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Claim to 11:</strong>
|
||||
<%= card_provider.claim_to_11 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider line 6:</strong>
|
||||
<%= card_provider.provider_line_6 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider line 7:</strong>
|
||||
<%= card_provider.provider_line_7 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider line 8:</strong>
|
||||
<%= card_provider.provider_line_8 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider line 9:</strong>
|
||||
<%= card_provider.provider_line_9 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider line 10:</strong>
|
||||
<%= card_provider.provider_line_10 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider line 11:</strong>
|
||||
<%= card_provider.provider_line_11 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Rx group:</strong>
|
||||
<%= card_provider.rx_group_id %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Rx contact:</strong>
|
||||
<%= card_provider.rx_contact %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider lookup 1:</strong>
|
||||
<%= card_provider.provider_lookup_1 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider lookup 2:</strong>
|
||||
<%= card_provider.provider_lookup_2 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Precert 1:</strong>
|
||||
<%= card_provider.precert_1 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Precert 2:</strong>
|
||||
<%= card_provider.precert_2 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Precert 3:</strong>
|
||||
<%= card_provider.precert_3 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Precert 4:</strong>
|
||||
<%= card_provider.precert_4 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Precert 5:</strong>
|
||||
<%= card_provider.precert_5 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Precert 6:</strong>
|
||||
<%= card_provider.precert_6 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Provider line 12:</strong>
|
||||
<%= card_provider.provider_line_12 %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Claim to 12:</strong>
|
||||
<%= card_provider.claim_to_12 %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,2 @@
|
||||
json.extract! card_provider, :id, :provider_code, :provider_line_1, :provider_line_2, :provider_line_3, :provider_line_4, :provider_line_5, :mail_to, :mail_to_2, :contact_line_1, :contact_line_2, :contact_line_3, :group_number, :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, :provider_line_6, :provider_line_7, :provider_line_8, :provider_line_9, :provider_line_10, :provider_line_11, :rx_group_id, :rx_contact, :provider_lookup_1, :provider_lookup_2, :precert_1, :precert_2, :precert_3, :precert_4, :precert_5, :precert_6, :provider_line_12, :claim_to_12, :created_at, :updated_at
|
||||
json.url card_provider_url(card_provider, format: :json)
|
||||
@@ -0,0 +1,222 @@
|
||||
<%= form_with(model: card_provider, class: "contents") do |form| %>
|
||||
<% if card_provider.errors.any? %>
|
||||
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-md mt-3">
|
||||
<h2><%= pluralize(card_provider.errors.count, "error") %> prohibited this card_provider from being saved:</h2>
|
||||
|
||||
<ul class="list-disc ml-6">
|
||||
<% card_provider.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_code %>
|
||||
<%= form.text_field :provider_code, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_code].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_code].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_line_1 %>
|
||||
<%= form.text_field :provider_line_1, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_line_1].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_line_1].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_line_2 %>
|
||||
<%= form.text_field :provider_line_2, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_line_2].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_line_2].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_line_3 %>
|
||||
<%= form.text_field :provider_line_3, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_line_3].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_line_3].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_line_4 %>
|
||||
<%= form.text_field :provider_line_4, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_line_4].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_line_4].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_line_5 %>
|
||||
<%= form.text_field :provider_line_5, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_line_5].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_line_5].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :mail_to %>
|
||||
<%= form.text_field :mail_to, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:mail_to].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:mail_to].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :mail_to_2 %>
|
||||
<%= form.text_field :mail_to_2, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:mail_to_2].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:mail_to_2].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :contact_line_1 %>
|
||||
<%= form.text_field :contact_line_1, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:contact_line_1].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:contact_line_1].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :contact_line_2 %>
|
||||
<%= form.text_field :contact_line_2, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:contact_line_2].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:contact_line_2].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :contact_line_3 %>
|
||||
<%= form.text_field :contact_line_3, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:contact_line_3].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:contact_line_3].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :group_number %>
|
||||
<%= form.text_field :group_number, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:group_number].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:group_number].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :claim_to_1 %>
|
||||
<%= form.text_field :claim_to_1, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:claim_to_1].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:claim_to_1].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :claim_to_2 %>
|
||||
<%= form.text_field :claim_to_2, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:claim_to_2].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:claim_to_2].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :claim_to_3 %>
|
||||
<%= form.text_field :claim_to_3, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:claim_to_3].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:claim_to_3].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :claim_to_4 %>
|
||||
<%= form.text_field :claim_to_4, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:claim_to_4].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:claim_to_4].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :claim_to_5 %>
|
||||
<%= form.text_field :claim_to_5, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:claim_to_5].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:claim_to_5].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :claim_to_6 %>
|
||||
<%= form.text_field :claim_to_6, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:claim_to_6].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:claim_to_6].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :claim_to_7 %>
|
||||
<%= form.text_field :claim_to_7, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:claim_to_7].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:claim_to_7].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :claim_to_8 %>
|
||||
<%= form.text_field :claim_to_8, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:claim_to_8].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:claim_to_8].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :claim_to_9 %>
|
||||
<%= form.text_field :claim_to_9, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:claim_to_9].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:claim_to_9].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :claim_to_10 %>
|
||||
<%= form.text_field :claim_to_10, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:claim_to_10].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:claim_to_10].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :claim_to_11 %>
|
||||
<%= form.text_field :claim_to_11, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:claim_to_11].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:claim_to_11].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_line_6 %>
|
||||
<%= form.text_field :provider_line_6, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_line_6].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_line_6].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_line_7 %>
|
||||
<%= form.text_field :provider_line_7, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_line_7].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_line_7].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_line_8 %>
|
||||
<%= form.text_field :provider_line_8, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_line_8].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_line_8].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_line_9 %>
|
||||
<%= form.text_field :provider_line_9, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_line_9].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_line_9].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_line_10 %>
|
||||
<%= form.text_field :provider_line_10, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_line_10].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_line_10].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_line_11 %>
|
||||
<%= form.text_field :provider_line_11, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_line_11].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_line_11].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :rx_group_id %>
|
||||
<%= form.text_field :rx_group_id, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:rx_group_id].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:rx_group_id].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :rx_contact %>
|
||||
<%= form.text_field :rx_contact, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:rx_contact].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:rx_contact].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_lookup_1 %>
|
||||
<%= form.text_field :provider_lookup_1, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_lookup_1].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_lookup_1].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_lookup_2 %>
|
||||
<%= form.text_field :provider_lookup_2, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_lookup_2].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_lookup_2].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :precert_1 %>
|
||||
<%= form.text_field :precert_1, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:precert_1].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:precert_1].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :precert_2 %>
|
||||
<%= form.text_field :precert_2, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:precert_2].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:precert_2].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :precert_3 %>
|
||||
<%= form.text_field :precert_3, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:precert_3].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:precert_3].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :precert_4 %>
|
||||
<%= form.text_field :precert_4, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:precert_4].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:precert_4].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :precert_5 %>
|
||||
<%= form.text_field :precert_5, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:precert_5].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:precert_5].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :precert_6 %>
|
||||
<%= form.text_field :precert_6, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:precert_6].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:precert_6].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :provider_line_12 %>
|
||||
<%= form.text_field :provider_line_12, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:provider_line_12].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:provider_line_12].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :claim_to_12 %>
|
||||
<%= form.text_field :claim_to_12, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_provider.errors[:claim_to_12].none?, "border-red-400 focus:outline-red-600": card_provider.errors[:claim_to_12].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="inline">
|
||||
<%= form.submit class: "w-full sm:w-auto rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,10 @@
|
||||
<% content_for :title, "Editing card provider" %>
|
||||
|
||||
<div class="md:w-2/3 w-full">
|
||||
<h1 class="font-bold text-4xl">Editing card provider</h1>
|
||||
|
||||
<%= render "form", card_provider: @card_provider %>
|
||||
|
||||
<%= link_to "Show this card provider", @card_provider, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
<%= link_to "Back to card providers", card_providers_path, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
<% content_for :title, "Card providers" %>
|
||||
|
||||
<div class="w-full">
|
||||
<% if notice.present? %>
|
||||
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block" id="notice"><%= notice %></p>
|
||||
<% end %>
|
||||
|
||||
<div class="flex justify-between items-center">
|
||||
<h1 class="font-bold text-4xl">Card providers</h1>
|
||||
<%= link_to "New card provider", new_card_provider_path, class: "rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white block font-medium" %>
|
||||
</div>
|
||||
|
||||
<div id="card_providers" class="min-w-full divide-y divide-gray-200 space-y-5">
|
||||
<% if @card_providers.any? %>
|
||||
<% @card_providers.each do |card_provider| %>
|
||||
<div class="flex flex-col sm:flex-row justify-between items-center pb-5 sm:pb-0">
|
||||
<%= render card_provider %>
|
||||
<div class="w-full sm:w-auto flex flex-col sm:flex-row space-x-2 space-y-2">
|
||||
<%= link_to "Show", card_provider, class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
<%= link_to "Edit", edit_card_provider_path(card_provider), class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
<%= button_to "Destroy", card_provider, method: :delete, class: "w-full sm:w-auto rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="text-center my-10">No card providers found.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
json.array! @card_providers, partial: "card_providers/card_provider", as: :card_provider
|
||||
@@ -0,0 +1,9 @@
|
||||
<% content_for :title, "New card provider" %>
|
||||
|
||||
<div class="md:w-2/3 w-full">
|
||||
<h1 class="font-bold text-4xl">New card provider</h1>
|
||||
|
||||
<%= render "form", card_provider: @card_provider %>
|
||||
|
||||
<%= link_to "Back to card providers", card_providers_path, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<% content_for :title, "Showing card provider" %>
|
||||
|
||||
<div class="md:w-2/3 w-full">
|
||||
<% if notice.present? %>
|
||||
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-md inline-block" id="notice"><%= notice %></p>
|
||||
<% end %>
|
||||
|
||||
<h1 class="font-bold text-4xl">Showing card provider</h1>
|
||||
|
||||
<%= render @card_provider %>
|
||||
|
||||
<%= link_to "Edit this card provider", edit_card_provider_path(@card_provider), class: "w-full sm:w-auto text-center rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
<%= link_to "Back to card providers", card_providers_path, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
<%= button_to "Destroy this card provider", @card_provider, method: :delete, form_class: "sm:inline-block mt-2 sm:mt-0 sm:ml-2", class: "w-full rounded-md px-3.5 py-2.5 text-white bg-red-600 hover:bg-red-500 font-medium cursor-pointer", data: { turbo_confirm: "Are you sure?" } %>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
json.partial! "card_providers/card_provider", card_provider: @card_provider
|
||||
@@ -0,0 +1,14 @@
|
||||
<div id="<%= dom_id card_rx %>" class="w-full sm:w-auto my-5 space-y-5">
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Help desk:</strong>
|
||||
<%= card_rx.help_desk %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Customer service:</strong>
|
||||
<%= card_rx.customer_service %>
|
||||
</div>
|
||||
<div>
|
||||
<strong class="block font-medium mb-1">Web url:</strong>
|
||||
<%= card_rx.web_url %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,2 @@
|
||||
json.extract! card_rx, :id, :help_desk, :customer_service, :web_url, :created_at, :updated_at
|
||||
json.url card_rx_url(card_rx, format: :json)
|
||||
@@ -0,0 +1,32 @@
|
||||
<%= form_with(model: card_rx, class: "contents") do |form| %>
|
||||
<% if card_rx.errors.any? %>
|
||||
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-md mt-3">
|
||||
<h2><%= pluralize(card_rx.errors.count, "error") %> prohibited this card_rx from being saved:</h2>
|
||||
|
||||
<ul class="list-disc ml-6">
|
||||
<% card_rx.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :help_desk %>
|
||||
<%= form.text_field :help_desk, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_rx.errors[:help_desk].none?, "border-red-400 focus:outline-red-600": card_rx.errors[:help_desk].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :customer_service %>
|
||||
<%= form.text_field :customer_service, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_rx.errors[:customer_service].none?, "border-red-400 focus:outline-red-600": card_rx.errors[:customer_service].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="my-5">
|
||||
<%= form.label :web_url %>
|
||||
<%= form.text_field :web_url, class: ["block shadow-sm rounded-md border px-3 py-2 mt-2 w-full", {"border-gray-400 focus:outline-blue-600": card_rx.errors[:web_url].none?, "border-red-400 focus:outline-red-600": card_rx.errors[:web_url].any?}] %>
|
||||
</div>
|
||||
|
||||
<div class="inline">
|
||||
<%= form.submit class: "w-full sm:w-auto rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -0,0 +1,10 @@
|
||||
<% content_for :title, "Editing card rx" %>
|
||||
|
||||
<div class="md:w-2/3 w-full">
|
||||
<h1 class="font-bold text-4xl">Editing card rx</h1>
|
||||
|
||||
<%= render "form", card_rx: @card_rx %>
|
||||
|
||||
<%= link_to "Show this card rx", @card_rx, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
<%= link_to "Back to card rxes", card_rxes_path, class: "w-full sm:w-auto text-center mt-2 sm:mt-0 sm:ml-2 rounded-md px-3.5 py-2.5 bg-gray-100 hover:bg-gray-50 inline-block font-medium" %>
|
||||
</div>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user