Compare commits
33 Commits
13b00749fa
..
beta
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a90ea6e14 | |||
| 5f04811c16 | |||
| 518522b080 | |||
| 826ef02322 | |||
| d25d5c9bba | |||
| 6c3649ad61 | |||
| f35cc99a0f | |||
| 34843e2da7 | |||
| 3bf9594842 | |||
| e0101be567 | |||
| 1d9025276d | |||
| 7ab1143db8 | |||
| 247a075c9c | |||
| 9f306d3150 | |||
| a43c8bf6b5 | |||
| 3300819ed5 | |||
| 011ee91707 | |||
| 8c885b3e76 | |||
| 6a068243f4 | |||
| 8ecabf60ff | |||
| b5a1517330 | |||
| ea07afb751 | |||
| 942d60c3e0 | |||
| 4fac3b1036 | |||
| 0464ba8929 | |||
| 78ce415b94 | |||
| 3fbece7da6 | |||
| d48bb96791 | |||
| 2beed66429 | |||
| 85f4dcc7ec | |||
| 1eb32f0fab | |||
| b5d0aa0bcd | |||
| 0ddd7d96ad |
@@ -0,0 +1,2 @@
|
||||
/app/assets/builds/*
|
||||
/app/assets/svg/*
|
||||
@@ -1,3 +0,0 @@
|
||||
PGHOST=db
|
||||
PGUSER=postgres
|
||||
PGPASSWORD=changeme
|
||||
+16
@@ -72,3 +72,19 @@ yarn-debug.log*
|
||||
/config/master.key
|
||||
|
||||
.DS_Store
|
||||
|
||||
/app/assets/builds/*
|
||||
/app/assets/svg/*
|
||||
!/app/assets/builds/.keep
|
||||
|
||||
/mssql-data
|
||||
/logo_files
|
||||
/employer_word_docs
|
||||
# Ignore application configuration
|
||||
/config/application.yml
|
||||
|
||||
/scratch.rb
|
||||
/start_rails.bat
|
||||
/web.config
|
||||
|
||||
/db/old
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ inherit_gem:
|
||||
rubocop-rails-omakase: rubocop.yml
|
||||
|
||||
AllCops:
|
||||
TargetRubyVersion: 3.4.2
|
||||
TargetRubyVersion: 3.4.8
|
||||
TargetRailsVersion: 7.2.2
|
||||
DisabledByDefault: true
|
||||
Exclude:
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
3.4.5
|
||||
3.4.8
|
||||
|
||||
+55
-44
@@ -1,73 +1,84 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# check=error=true
|
||||
# syntax = docker/dockerfile:1
|
||||
|
||||
# This Dockerfile is designed for production, not development.
|
||||
# docker build -t my-app .
|
||||
# docker run -d -p 80:80 -p 443:443 --name my-app -e RAILS_MASTER_KEY=<value from config/master.key> my-app
|
||||
# 1. Base Stage: Common dependencies
|
||||
ARG RUBY_VERSION=3.4.8
|
||||
FROM ruby:$RUBY_VERSION-slim as base
|
||||
|
||||
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
|
||||
ARG RUBY_VERSION=3.4.5
|
||||
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
|
||||
|
||||
# Rails app lives here
|
||||
WORKDIR /rails
|
||||
|
||||
# Install base packages
|
||||
RUN apt-get update -qq && \
|
||||
apt-get install --no-install-recommends -y curl libjemalloc2 libvips postgresql-client && \
|
||||
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
||||
|
||||
# Set production environment
|
||||
ENV RAILS_ENV="production" \
|
||||
BUNDLE_DEPLOYMENT="1" \
|
||||
BUNDLE_PATH="/usr/local/bundle" \
|
||||
BUNDLE_WITHOUT="development"
|
||||
BUNDLE_WITHOUT="development:test"
|
||||
|
||||
# Throw-away build stage to reduce size of final image
|
||||
FROM base AS build
|
||||
|
||||
# Install packages needed to build gems
|
||||
# Install base packages (libvips for Active Storage, curl for healthchecks)
|
||||
RUN apt-get update -qq && \
|
||||
apt-get install --no-install-recommends -y build-essential git libpq-dev pkg-config libyaml-dev && \
|
||||
apt-get install --no-install-recommends -y \
|
||||
curl \
|
||||
git \
|
||||
libvips \
|
||||
freetds-bin \
|
||||
freetds-dev \
|
||||
libpq-dev \
|
||||
libyaml-dev \
|
||||
cron \
|
||||
libjemalloc2 \
|
||||
dos2unix && \
|
||||
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
||||
|
||||
# 2. Build Stage: Gems and Assets
|
||||
FROM base as build
|
||||
|
||||
# Install packages needed to build gems and precompile assets
|
||||
RUN apt-get update -qq && \
|
||||
apt-get install --no-install-recommends -y build-essential pkg-config less && \
|
||||
# mkdir -p /etc/apt/keyrings && \
|
||||
# curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
|
||||
# echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" > /etc/apt/sources.list.d/nodesource.list && \
|
||||
# apt-get update && \
|
||||
# apt-get install nodejs -y && \
|
||||
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
||||
|
||||
# RUN apt-get install -y npm
|
||||
# RUN npm install -g yarn
|
||||
|
||||
# Install application gems
|
||||
RUN bundle config set --local frozen false
|
||||
COPY Gemfile Gemfile.lock ./
|
||||
RUN bundle install && \
|
||||
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
|
||||
bundle exec bootsnap precompile --gemfile
|
||||
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
|
||||
|
||||
# Copy application code
|
||||
COPY . .
|
||||
|
||||
# Precompile bootsnap code for faster boot times
|
||||
RUN bundle exec bootsnap precompile app/ lib/
|
||||
RUN ./bin/rails stimulus:manifest:update
|
||||
RUN ./bin/importmap pin .
|
||||
|
||||
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
|
||||
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
|
||||
# RUN bundle exec ./bin/rails rails_icons:sync
|
||||
RUN ./bin/rails generate rails_icons:sync --libraries=lucide
|
||||
|
||||
# Precompile assets (Tailwind is triggered here via assets:precompile)
|
||||
# SECRET_KEY_BASE_DUMMY allows precompilation without real secrets
|
||||
# RUN bundle exec rails assets:clobber assets:precompile RAILS_ENV=production SECRET_KEY_BASE_DUMMY=1
|
||||
RUN bundle exec rails assets:precompile RAILS_ENV=production SECRET_KEY_BASE_DUMMY=1
|
||||
|
||||
# Final stage for app image
|
||||
# 3. Final Stage: Lean Runtime
|
||||
FROM base
|
||||
|
||||
# Copy built artifacts: gems, application
|
||||
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
|
||||
# Copy built artifacts: gems and precompiled assets
|
||||
# COPY --from=build /rails/public /rails/public
|
||||
# COPY --from=build /rails/app/javascript /rails/app/javascript
|
||||
# COPY --from=build /rails/config/importmap.rb /rails/config/importmap.rb
|
||||
COPY --from=build /usr/local/bundle /usr/local/bundle
|
||||
COPY --from=build /rails /rails
|
||||
|
||||
# Run and own only the runtime files as a non-root user for security
|
||||
RUN groupadd --system --gid 1000 rails && \
|
||||
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
|
||||
chown -R rails:rails db log storage tmp
|
||||
USER 1000:1000
|
||||
# Run as a non-privileged user for security
|
||||
RUN useradd -ms /bin/bash rails
|
||||
RUN chown -R rails:rails /rails
|
||||
USER rails:rails
|
||||
|
||||
# Entrypoint prepares the database.
|
||||
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
||||
|
||||
HEALTHCHECK --interval=15s --timeout=3s --start-period=0s --start-interval=5s --retries=3 \
|
||||
CMD curl -f http://localhost:3000/up || exit 1
|
||||
# Start the server by default, this can be overwritten at runtime
|
||||
EXPOSE 3000
|
||||
|
||||
# The default Rails Dockerfile uses `./bin/rails server`, but when using Puma,
|
||||
# they recommend using bundle exec puma. ref: https://github.com/puma/puma#rails
|
||||
# Start the server
|
||||
EXPOSE 3002
|
||||
CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]
|
||||
|
||||
@@ -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.4.8"
|
||||
|
||||
# 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,24 @@ 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 'httparty'
|
||||
gem 'combine_pdf'
|
||||
gem 'pdf-reader'
|
||||
gem 'rails_icons'
|
||||
gem 'fastimage'
|
||||
gem 'rubyzip', require: 'zip'
|
||||
# gem "solid_queue"
|
||||
gem 'delayed_job_active_record'
|
||||
gem 'daemons'
|
||||
gem 'image_processing'
|
||||
gem "ruby-vips"
|
||||
gem 'whenever', require: false
|
||||
gem 'amatch'
|
||||
gem 'figaro'
|
||||
+264
-184
@@ -1,66 +1,72 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (7.2.2.2)
|
||||
actionpack (= 7.2.2.2)
|
||||
activesupport (= 7.2.2.2)
|
||||
Ascii85 (2.0.1)
|
||||
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.9)
|
||||
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
|
||||
@@ -72,20 +78,25 @@ GEM
|
||||
minitest (>= 5.1)
|
||||
securerandom (>= 0.3)
|
||||
tzinfo (~> 2.0, >= 2.0.5)
|
||||
addressable (2.8.7)
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
addressable (2.9.0)
|
||||
public_suffix (>= 2.0.2, < 8.0)
|
||||
afm (1.0.0)
|
||||
amatch (0.6.0)
|
||||
mize
|
||||
tins (~> 1)
|
||||
ast (2.4.3)
|
||||
base64 (0.3.0)
|
||||
benchmark (0.4.1)
|
||||
bigdecimal (3.2.2)
|
||||
bcrypt (3.1.22)
|
||||
benchmark (0.5.0)
|
||||
bigdecimal (4.1.2)
|
||||
bindex (0.8.1)
|
||||
bootsnap (1.18.6)
|
||||
bootsnap (1.24.3)
|
||||
msgpack (~> 1.2)
|
||||
brakeman (7.1.0)
|
||||
brakeman (8.0.4)
|
||||
racc
|
||||
builder (3.3.0)
|
||||
bundler-audit (0.9.2)
|
||||
bundler (>= 1.2.0, < 3)
|
||||
bundler-audit (0.9.3)
|
||||
bundler (>= 1.2.0)
|
||||
thor (~> 1.0)
|
||||
capybara (3.40.0)
|
||||
addressable
|
||||
@@ -96,64 +107,96 @@ GEM
|
||||
rack-test (>= 0.6.3)
|
||||
regexp_parser (>= 1.5, < 3.0)
|
||||
xpath (~> 3.2)
|
||||
concurrent-ruby (1.3.5)
|
||||
connection_pool (2.5.3)
|
||||
cgi (0.5.1)
|
||||
chronic (0.10.2)
|
||||
coderay (1.1.3)
|
||||
combine_pdf (1.0.31)
|
||||
matrix
|
||||
ruby-rc4 (>= 0.1.5)
|
||||
concurrent-ruby (1.3.6)
|
||||
connection_pool (3.0.2)
|
||||
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)
|
||||
daemons (1.4.1)
|
||||
date (3.5.1)
|
||||
delayed_job (4.2.0)
|
||||
activesupport (>= 3.0, < 9.0)
|
||||
benchmark
|
||||
logger
|
||||
delayed_job_active_record (4.1.11)
|
||||
activerecord (>= 3.0, < 9.0)
|
||||
delayed_job (>= 3.0, < 5)
|
||||
devise (5.0.3)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 7.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 (6.0.4)
|
||||
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.1)
|
||||
ffi (1.17.4-x86_64-linux-gnu)
|
||||
figaro (1.3.0)
|
||||
thor (>= 0.14.0, < 2)
|
||||
globalid (1.3.0)
|
||||
activesupport (>= 6.1)
|
||||
i18n (1.14.7)
|
||||
hashery (2.1.2)
|
||||
httparty (0.24.2)
|
||||
csv
|
||||
mini_mime (>= 1.0.0)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (1.14.8)
|
||||
concurrent-ruby (~> 1.0)
|
||||
icons (0.8.1)
|
||||
nokogiri (~> 1.16, >= 1.16.4)
|
||||
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.3)
|
||||
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.2)
|
||||
irb (1.18.0)
|
||||
pp (>= 0.6.0)
|
||||
prism (>= 1.3.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.19.5)
|
||||
language_server-protocol (3.17.0.5)
|
||||
lint_roller (1.1.0)
|
||||
logger (1.7.0)
|
||||
loofah (2.24.1)
|
||||
loofah (2.25.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
|
||||
marcel (1.1.0)
|
||||
matrix (0.4.3)
|
||||
method_source (1.1.0)
|
||||
mini_magick (5.3.1)
|
||||
logger
|
||||
mini_mime (1.1.5)
|
||||
minitest (5.25.5)
|
||||
minitest (6.0.6)
|
||||
drb (~> 2.0)
|
||||
prism (~> 1.5)
|
||||
mize (0.6.1)
|
||||
msgpack (1.8.0)
|
||||
net-imap (0.5.7)
|
||||
multi_xml (0.9.1)
|
||||
bigdecimal (>= 3.1, < 5)
|
||||
net-imap (0.6.4)
|
||||
date
|
||||
net-protocol
|
||||
net-pop (0.1.2)
|
||||
@@ -162,126 +205,134 @@ 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.19.3-x86_64-linux-gnu)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-aarch64-linux-musl)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-arm-linux-gnu)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-arm-linux-musl)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-arm64-darwin)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-x86_64-darwin)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-x86_64-linux-gnu)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.9-x86_64-linux-musl)
|
||||
racc (~> 1.4)
|
||||
parallel (1.27.0)
|
||||
parser (3.3.9.0)
|
||||
orm_adapter (0.5.0)
|
||||
parallel (2.1.0)
|
||||
parser (3.3.11.1)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
pg (1.5.9)
|
||||
pp (0.6.2)
|
||||
pdf-reader (2.15.1)
|
||||
Ascii85 (>= 1.0, < 3.0, != 2.0.0)
|
||||
afm (>= 0.2.1, < 2)
|
||||
hashery (~> 2.0)
|
||||
ruby-rc4
|
||||
ttfunk
|
||||
pp (0.6.3)
|
||||
prettyprint
|
||||
prettyprint (0.2.0)
|
||||
prism (1.4.0)
|
||||
psych (5.2.3)
|
||||
prism (1.9.0)
|
||||
pry (0.16.0)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
reline (>= 0.6.0)
|
||||
pry-rails (0.3.11)
|
||||
pry (>= 0.13.0)
|
||||
psych (5.3.1)
|
||||
date
|
||||
stringio
|
||||
public_suffix (6.0.1)
|
||||
public_suffix (7.0.5)
|
||||
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.6)
|
||||
rack-mini-profiler (4.0.1)
|
||||
rack (>= 1.2.0)
|
||||
rack-session (2.1.1)
|
||||
rack-session (2.1.2)
|
||||
base64 (>= 0.1.0)
|
||||
rack (>= 3.0.0)
|
||||
rack-test (2.2.0)
|
||||
rack (>= 1.3)
|
||||
rackup (2.2.1)
|
||||
rackup (2.3.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
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.6.2)
|
||||
loofah (~> 2.21)
|
||||
rails-html-sanitizer (1.7.0)
|
||||
loofah (~> 2.25)
|
||||
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.8.0)
|
||||
icons (~> 0.8.1)
|
||||
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.4.2)
|
||||
rdoc (7.2.0)
|
||||
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
|
||||
readline (0.0.4)
|
||||
reline
|
||||
regexp_parser (2.12.0)
|
||||
reline (0.6.3)
|
||||
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)
|
||||
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)
|
||||
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.8)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.13.0)
|
||||
rspec-rails (8.0.4)
|
||||
actionpack (>= 7.2)
|
||||
activesupport (>= 7.2)
|
||||
railties (>= 7.2)
|
||||
rspec-core (>= 3.13.0, < 5.0.0)
|
||||
rspec-expectations (>= 3.13.0, < 5.0.0)
|
||||
rspec-mocks (>= 3.13.0, < 5.0.0)
|
||||
rspec-support (>= 3.13.0, < 5.0.0)
|
||||
rspec-support (3.13.7)
|
||||
rubocop (1.86.1)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
parallel (~> 1.10)
|
||||
parallel (>= 1.10)
|
||||
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.49.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 4.0)
|
||||
rubocop-ast (1.46.0)
|
||||
rubocop-ast (1.49.1)
|
||||
parser (>= 3.3.7.2)
|
||||
prism (~> 1.4)
|
||||
rubocop-performance (1.24.0)
|
||||
prism (~> 1.7)
|
||||
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.34.3)
|
||||
activesupport (>= 4.2.0)
|
||||
lint_roller (~> 1.1)
|
||||
rack (>= 1.1)
|
||||
@@ -291,23 +342,25 @@ GEM
|
||||
rubocop (>= 1.72)
|
||||
rubocop-performance (>= 1.24)
|
||||
rubocop-rails (>= 2.30)
|
||||
rubocop-rspec (3.6.0)
|
||||
rubocop-rspec (3.9.0)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (~> 1.72, >= 1.72.1)
|
||||
rubocop (~> 1.81)
|
||||
ruby-progressbar (1.13.0)
|
||||
ruby-vips (2.2.3)
|
||||
ruby-rc4 (0.1.5)
|
||||
ruby-vips (2.3.0)
|
||||
ffi (~> 1.12)
|
||||
logger
|
||||
rubyzip (2.4.1)
|
||||
rubyzip (3.3.0)
|
||||
securerandom (0.4.1)
|
||||
selenium-webdriver (4.35.0)
|
||||
selenium-webdriver (4.43.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,69 +368,96 @@ GEM
|
||||
sprockets (>= 3.0.0)
|
||||
stimulus-rails (1.3.4)
|
||||
railties (>= 6.0.0)
|
||||
stringio (3.1.5)
|
||||
thor (1.4.0)
|
||||
timeout (0.4.3)
|
||||
turbo-rails (2.0.13)
|
||||
stringio (3.2.0)
|
||||
sync (0.5.0)
|
||||
tailwindcss-rails (4.4.0)
|
||||
railties (>= 7.0.0)
|
||||
tailwindcss-ruby (~> 4.0)
|
||||
tailwindcss-ruby (4.2.4-x86_64-linux-gnu)
|
||||
thor (1.5.0)
|
||||
timeout (0.6.1)
|
||||
tins (1.53.0)
|
||||
bigdecimal
|
||||
mize (~> 0.6)
|
||||
readline
|
||||
sync
|
||||
tiny_tds (3.4.0-x86_64-linux-gnu)
|
||||
bigdecimal (>= 2.0.0)
|
||||
tsort (0.2.0)
|
||||
ttfunk (1.7.0)
|
||||
turbo-rails (2.0.23)
|
||||
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.2.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)
|
||||
whenever (1.1.2)
|
||||
chronic (>= 0.6.3)
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
zeitwerk (2.7.2)
|
||||
zeitwerk (2.7.5)
|
||||
|
||||
PLATFORMS
|
||||
aarch64-linux-gnu
|
||||
aarch64-linux-musl
|
||||
arm-linux-gnu
|
||||
arm-linux-musl
|
||||
arm64-darwin
|
||||
x86_64-darwin
|
||||
x86_64-linux-gnu
|
||||
x86_64-linux-musl
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
activerecord-sqlserver-adapter
|
||||
amatch
|
||||
bootsnap
|
||||
brakeman
|
||||
bundler-audit
|
||||
capybara
|
||||
debug
|
||||
image_processing (~> 1.2)
|
||||
combine_pdf
|
||||
daemons
|
||||
delayed_job_active_record
|
||||
devise
|
||||
docx
|
||||
fastimage
|
||||
figaro
|
||||
httparty
|
||||
image_processing
|
||||
importmap-rails
|
||||
jbuilder
|
||||
pg (~> 1.5)
|
||||
pdf-reader
|
||||
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
|
||||
ruby-vips
|
||||
rubyzip
|
||||
selenium-webdriver
|
||||
sprockets-rails
|
||||
stimulus-rails
|
||||
tailwindcss-rails
|
||||
tiny_tds
|
||||
turbo-rails
|
||||
tzinfo-data
|
||||
web-console
|
||||
whenever
|
||||
|
||||
RUBY VERSION
|
||||
ruby 3.4.5p51
|
||||
ruby 3.4.8p72
|
||||
|
||||
BUNDLED WITH
|
||||
2.6.5
|
||||
2.6.9
|
||||
|
||||
+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,45 @@
|
||||
@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;
|
||||
/* cobalt blue */
|
||||
--color-cobalt-vivid: #005DE0;
|
||||
/* #3388FF */
|
||||
/* 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;
|
||||
/* oxidized copper/bronze green-blue */
|
||||
--color-verdigris-vivid: #618D94;
|
||||
/* alert red */
|
||||
--color-brightlava: #f80800;
|
||||
/* alert green */
|
||||
--color-limegreen: #32CD32;
|
||||
}
|
||||
@@ -1,4 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
include Pundit::Authorization
|
||||
before_action :authenticate_user!
|
||||
|
||||
def after_sign_in_path_for(resource)
|
||||
stored_location_for(resource) || dashboard_path
|
||||
end
|
||||
|
||||
def after_sign_out_path_for(resource_or_scope)
|
||||
root_path
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
class ArticlesController < ApplicationController
|
||||
before_action :set_article, only: %i[ show edit update destroy ]
|
||||
|
||||
# GET /articles or /articles.json
|
||||
def index
|
||||
@articles = Article.all
|
||||
end
|
||||
|
||||
# GET /articles/1 or /articles/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /articles/new
|
||||
def new
|
||||
@article = Article.new
|
||||
end
|
||||
|
||||
# GET /articles/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /articles or /articles.json
|
||||
def create
|
||||
@article = Article.new(article_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @article.save
|
||||
format.html { redirect_to @article, notice: "Article was successfully created." }
|
||||
format.json { render :show, status: :created, location: @article }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.json { render json: @article.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /articles/1 or /articles/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @article.update(article_params)
|
||||
format.html { redirect_to @article, notice: "Article was successfully updated." }
|
||||
format.json { render :show, status: :ok, location: @article }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
format.json { render json: @article.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /articles/1 or /articles/1.json
|
||||
def destroy
|
||||
@article.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to articles_url, notice: "Article was successfully destroyed." }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_article
|
||||
@article = Article.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def article_params
|
||||
params.require(:article).permit(:title, :content)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
class BrokersController < ApplicationController
|
||||
before_action :set_broker, only: %i[ show edit update destroy ]
|
||||
|
||||
# GET /brokers or /brokers.json
|
||||
def index
|
||||
@brokers = Broker.all
|
||||
end
|
||||
|
||||
# GET /brokers/1 or /brokers/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /brokers/new
|
||||
def new
|
||||
@broker = Broker.new
|
||||
end
|
||||
|
||||
# GET /brokers/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /brokers or /brokers.json
|
||||
def create
|
||||
@broker = Broker.new(broker_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @broker.save
|
||||
format.html { redirect_to @broker, notice: "Broker was successfully created." }
|
||||
format.json { render :show, status: :created, location: @broker }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.json { render json: @broker.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /brokers/1 or /brokers/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @broker.update(broker_params)
|
||||
format.html { redirect_to @broker, notice: "Broker was successfully updated.", status: :see_other }
|
||||
format.json { render :show, status: :ok, location: @broker }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
format.json { render json: @broker.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /brokers/1 or /brokers/1.json
|
||||
def destroy
|
||||
@broker.destroy!
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to brokers_path, notice: "Broker 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_broker
|
||||
@broker = Broker.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def broker_params
|
||||
params.require(:broker).permit(:name, :carrier_id)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
class CarriersController < ApplicationController
|
||||
before_action :set_carrier, only: %i[ show edit update destroy ]
|
||||
|
||||
# GET /carriers or /carriers.json
|
||||
def index
|
||||
@carriers = Carrier.all
|
||||
end
|
||||
|
||||
# GET /carriers/1 or /carriers/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /carriers/new
|
||||
def new
|
||||
@carrier = Carrier.new
|
||||
end
|
||||
|
||||
# GET /carriers/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /carriers or /carriers.json
|
||||
def create
|
||||
@carrier = Carrier.new(carrier_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @carrier.save
|
||||
format.html { redirect_to @carrier, notice: "Carrier was successfully created." }
|
||||
format.json { render :show, status: :created, location: @carrier }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.json { render json: @carrier.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /carriers/1 or /carriers/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @carrier.update(carrier_params)
|
||||
format.html { redirect_to @carrier, notice: "Carrier was successfully updated.", status: :see_other }
|
||||
format.json { render :show, status: :ok, location: @carrier }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
format.json { render json: @carrier.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /carriers/1 or /carriers/1.json
|
||||
def destroy
|
||||
@carrier.destroy!
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to carriers_path, notice: "Carrier 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_carrier
|
||||
@carrier = Carrier.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def carrier_params
|
||||
params.require(:carrier).permit(:name)
|
||||
end
|
||||
end
|
||||
@@ -1,13 +0,0 @@
|
||||
class CommentsController < ApplicationController
|
||||
before_action :set_article
|
||||
|
||||
def create
|
||||
@article.comments.create! params.required(:comment).permit(:content)
|
||||
redirect_to @article
|
||||
end
|
||||
|
||||
private
|
||||
def set_article
|
||||
@article = Article.find(params[:article_id])
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class DashboardController < ApplicationController
|
||||
def index
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,91 @@
|
||||
class EmployersController < ApplicationController
|
||||
|
||||
# View Methods
|
||||
def index
|
||||
@uninitialized = Employer.in_automation_initilization
|
||||
@with_active_id_card_setup = Employer.active
|
||||
current_group_numbers = @with_active_id_card_setup.pluck(:group_number)
|
||||
valid_group_numbers = ["62210","61986","42018","41283","0230643","43190","0230642","0230644","0230646","0233955","600102","0249127","0257902","0257947","600112","600114","0261611","600117","0261684","0261685","0261826","600121","0265450","600123","0267470","0268540","0268599"]
|
||||
@beta_unassigned_group_numbers = valid_group_numbers - current_group_numbers
|
||||
@deactivated = Employer.deactivated
|
||||
end
|
||||
|
||||
def show
|
||||
@employer = Employer.find_by(slug: params[:id])
|
||||
end
|
||||
|
||||
def new
|
||||
@employer = Employer.new
|
||||
render :new
|
||||
end
|
||||
|
||||
def create
|
||||
employer_params = Employer.permitted_params(params)
|
||||
@employer = Employer.new(employer_params)
|
||||
if @employer.save
|
||||
redirect_to employer_path(@employer.slug), notice: 'Employer Saved'
|
||||
else
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@employer = Employer.find_by(slug: params[:id])
|
||||
render :edit
|
||||
end
|
||||
|
||||
def update
|
||||
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
|
||||
@employer = Employer.find(params[:id])
|
||||
@employer.destroy
|
||||
redirect_to employers_path, notice: "#{@employer.name} was successfully deleted."
|
||||
end
|
||||
|
||||
|
||||
# API Methods
|
||||
|
||||
def refresh_employer_information
|
||||
@employer = Employer.find(params[:id])
|
||||
@employer.sync_with_vhcs
|
||||
redirect_to employer_path(@employer.slug)
|
||||
end
|
||||
|
||||
def refresh_employer_members_information
|
||||
@employer = Employer.find(params[:id])
|
||||
@employer.sync_members_with_vhcs
|
||||
redirect_to employer_path(@employer.slug)
|
||||
end
|
||||
|
||||
def beta_automation_simulation
|
||||
BetaAutomationSimulationService.new().call
|
||||
redirect_to employers_path
|
||||
end
|
||||
|
||||
def import
|
||||
word_doc = params[:employer][:import_from_word]
|
||||
if word_doc.present? && word_doc.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
@employer = BenefitsWordDocService::WordDocProcessor.new(word_doc.tempfile).call
|
||||
@employer.save
|
||||
redirect_to employer_path(@employer.slug), notice: 'Employer Imported'
|
||||
else
|
||||
@employer = Employer.new
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
end
|
||||
@@ -0,0 +1,61 @@
|
||||
module IdCard
|
||||
class EmployerLogosController < ApplicationController
|
||||
|
||||
# View Methods
|
||||
def index
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
def create
|
||||
file = logo_params["logo_file"]
|
||||
employer_id = logo_params["employer_id"]
|
||||
employer = Employer.find(employer_id)
|
||||
setup = employer.id_card_setup
|
||||
if setup.present? && 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)
|
||||
|
||||
employer_logo = IdCard::EmployerLogo.find_or_create_by(filename: filename, setup_id: setup.id)
|
||||
employer_logo.update(image_data: binary_data)
|
||||
|
||||
render json: employer_logo, only: [:id], status: :ok
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
end
|
||||
|
||||
def destroy
|
||||
end
|
||||
|
||||
# API Methods
|
||||
|
||||
def image
|
||||
logo_file = IdCard::EmployerLogo.find(params[:id])
|
||||
puts params[:id]
|
||||
logo_binary = logo_file.image_data
|
||||
logo_filename = logo_file.filename
|
||||
|
||||
send_data logo_binary,
|
||||
filename: logo_filename,
|
||||
disposition: 'inline'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def logo_params
|
||||
params.require(:id_card_employer_logo).permit(:logo_file, :employer_id)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,61 @@
|
||||
module IdCard
|
||||
class NetworkLogosController < ApplicationController
|
||||
|
||||
# View Methods
|
||||
def index
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
def create
|
||||
file = logo_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)
|
||||
|
||||
networklogo = IdCard::NetworkLogo.create(
|
||||
filename: filename,
|
||||
image_data: binary_data,
|
||||
content_type: meme_type
|
||||
)
|
||||
|
||||
render json: networklogo, only: [:id], status: :ok
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
end
|
||||
|
||||
def destroy
|
||||
end
|
||||
|
||||
# API Methods
|
||||
|
||||
def image
|
||||
logo_file = IdCard::NetworkLogo.find(params[:id])
|
||||
puts params[:id]
|
||||
logo_binary = logo_file.image_data
|
||||
logo_filename = logo_file.filename
|
||||
|
||||
send_data logo_binary,
|
||||
filename: logo_filename,
|
||||
disposition: 'inline'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def logo_params
|
||||
params.require(:id_card_network_logo).permit(:logo_file)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,40 @@
|
||||
module IdCard
|
||||
class PlansController < ApplicationController
|
||||
|
||||
# View Methods
|
||||
def new
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
||||
end
|
||||
|
||||
# API Methods
|
||||
|
||||
def get_plan_template
|
||||
@template_plan = IdCard::Plan.includes(:plan_benefits).find_by(id: params[:id], template: true)
|
||||
render json: @template_plan.as_json(
|
||||
only: [:title],
|
||||
include: {
|
||||
plan_benefits: { except: [:id, :plan_id, :created_at, :updated_at] }
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,133 @@
|
||||
module IdCard
|
||||
class PrintController < ApplicationController
|
||||
|
||||
# View Methods
|
||||
def index
|
||||
@employer_setups = IdCard::Setup.active.to_a
|
||||
@queue_members = IdCardQueueService::GetQueuedMembers.new().call
|
||||
update_missing_members(@queue_members)
|
||||
add_queued_count_to_employer_setup(@queue_members)
|
||||
@queued = @employer_setups.select { |setup| setup.queued_card_count > 0 }.sort_by { |setup| setup.print_name }
|
||||
@not_queued = @employer_setups.select { |setup| setup.queued_card_count == 0 }.sort_by { |setup| setup.print_name }
|
||||
render :index
|
||||
end
|
||||
|
||||
# API Methods
|
||||
|
||||
def print_all_queued
|
||||
@queue_members = IdCardQueueService::GetQueuedMembers.new().call
|
||||
# @queue_members.delete_if { |em| ["2", "19", "16", "54"].include?(em[:pl_plan_key])}
|
||||
# @queue_members.push({pl_plan_key: "54", member_keys: [383840]})
|
||||
|
||||
cards_pdf = IdCardPrinterService::CardsGenerator.new(@queue_members, "PrintCard").call
|
||||
|
||||
send_data cards_pdf.to_pdf,
|
||||
filename: "all_queued_cards_#{Date.today}.pdf",
|
||||
type: "application/pdf",
|
||||
disposition: 'attachment'
|
||||
|
||||
end
|
||||
|
||||
def print_queued_by_employer
|
||||
pl_plan_key = params[:id].to_s
|
||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||
@queue_members = IdCardQueueService::GetQueuedMembers.new(pl_plan_key).call
|
||||
# @queue_members.first[:member_keys].delete(379590) && @queue_members.first[:member_keys].push(379610)
|
||||
cards_pdf = IdCardPrinterService::CardsGenerator.new(@queue_members, "PrintCard").call
|
||||
|
||||
send_data cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_queued_cards_#{Date.today}.pdf",
|
||||
type: "application/pdf",
|
||||
disposition: 'attachment'
|
||||
|
||||
end
|
||||
|
||||
def generate_sample
|
||||
employer_id = params[:id]
|
||||
@employer = Employer.find(employer_id)
|
||||
sample_cards_pdf = IdCardPrinterService::SampleCardsGenerator.new(@employer.id).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
|
||||
if Integer(params[:id], exception: false).is_a?(Integer)
|
||||
pl_plan_key = params[:id].to_s
|
||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||
else
|
||||
slug = params[:id]
|
||||
@employer = Employer.find_by(slug: slug)
|
||||
end
|
||||
cards_pdf = IdCardPrinterService::CardsGenerator.new(@employer.employer_member_keys, "PrintCard").call
|
||||
|
||||
send_data cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_print_cards_#{Date.today}.pdf",
|
||||
type: "application/pdf",
|
||||
disposition: 'attachment'
|
||||
|
||||
end
|
||||
|
||||
def generate_mobile_display
|
||||
if Integer(params[:id], exception: false).is_a?(Integer)
|
||||
pl_plan_key = params[:id].to_s
|
||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||
else
|
||||
slug = params[:id]
|
||||
@employer = Employer.find_by(slug: slug)
|
||||
end
|
||||
cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "MobileDisplayCard").call
|
||||
|
||||
send_data cards_pdf.to_pdf,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_mobile_display_cards_#{Date.today}.pdf",
|
||||
type: "application/pdf",
|
||||
disposition: 'attachment'
|
||||
|
||||
end
|
||||
|
||||
def generate_full_page
|
||||
if Integer(params[:id], exception: false).is_a?(Integer)
|
||||
pl_plan_key = params[:id].to_s
|
||||
@employer = Employer.find_by(pl_plan_key: pl_plan_key)
|
||||
else
|
||||
slug = params[:id]
|
||||
@employer = Employer.find_by(slug: slug)
|
||||
end
|
||||
cards_pdf = IdCardPrinterService::CardsGenerator.new(@employer.employer_member_keys, "FullPageCard", true).call
|
||||
# cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call
|
||||
|
||||
cards_pdf.rewind
|
||||
send_data cards_pdf.sysread,
|
||||
filename: "#{@employer.name.parameterize(separator: "_")}_full_page_cards_#{Date.today}.zip",
|
||||
type: 'application/zip',
|
||||
disposition: 'attachment'
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_missing_members(queued_employer_members)
|
||||
queued_employer_members.each do |queued_employer|
|
||||
existing_members = Member.where(pb_entity_key: queued_employer[:member_keys]).pluck(:pb_entity_key)
|
||||
missing_members = queued_employer[:member_keys] - existing_members
|
||||
missing_members.each do |pb_entity_key|
|
||||
AutomationService::MemberUpdate.new(queued_employer[:pl_plan_key], pb_entity_key).call
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def add_queued_count_to_employer_setup(queued_employer_members)
|
||||
queued_employer_members.each do |queued_employer|
|
||||
match = @employer_setups.find { |setup| setup.pl_plan_key == queued_employer[:pl_plan_key] }
|
||||
if match.present?
|
||||
match.queued_card_count = queued_employer[:member_keys].length
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,49 @@
|
||||
module IdCard
|
||||
class PrintDataController < ApplicationController
|
||||
|
||||
# def generate_sample
|
||||
# @employer = Employer.find_by(slug: params[:employer_slug])
|
||||
# sample_cards_pdf = IdCardPrinterService::SampleCardsGenerator.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])
|
||||
# cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "PrintCard").call
|
||||
|
||||
# send_data cards_pdf.to_pdf,
|
||||
# filename: "#{@employer.name.parameterize(separator: "_")}_print_cards_#{Date.today}.pdf",
|
||||
# type: "application/pdf",
|
||||
# disposition: 'attachment'
|
||||
|
||||
# end
|
||||
|
||||
# def generate_mobile_display
|
||||
# @employer = Employer.find_by(slug: params[:employer_slug])
|
||||
# cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "MobileDisplayCard").call
|
||||
|
||||
# send_data cards_pdf.to_pdf,
|
||||
# filename: "#{@employer.name.parameterize(separator: "_")}_mobile_display_cards_#{Date.today}.pdf",
|
||||
# type: "application/pdf",
|
||||
# disposition: 'attachment'
|
||||
|
||||
# end
|
||||
|
||||
# def generate_full_page
|
||||
# @employer = Employer.find_by(slug: params[:employer_slug])
|
||||
# cards_pdf = IdCardPrinterService::EmployerCardsGenerator.new(@employer, "FullPageCard", true).call
|
||||
|
||||
# cards_pdf.rewind
|
||||
# send_data cards_pdf.sysread,
|
||||
# filename: "#{@employer.name.parameterize(separator: "_")}_full_page_cards_#{Date.today}.zip",
|
||||
# type: 'application/zip',
|
||||
# disposition: 'attachment'
|
||||
|
||||
# end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,40 @@
|
||||
module IdCard
|
||||
class ProviderSectionsController < ApplicationController
|
||||
|
||||
# View Methods
|
||||
def index
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
def create
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
end
|
||||
|
||||
def destroy
|
||||
end
|
||||
|
||||
# API Methods
|
||||
|
||||
def get_section_data
|
||||
@provider_section = IdCard::ProviderSection.find(params[:id])
|
||||
render json: @provider_section.as_json
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def logo_params
|
||||
params.require(:id_card_network_logo).permit(:logo_file)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,107 @@
|
||||
module IdCard
|
||||
class SetupController < ApplicationController
|
||||
before_action :set_employer_and_setup
|
||||
|
||||
# View Methods
|
||||
|
||||
def index
|
||||
if @setup.provider_section.present? && !@setup.provider_section.default
|
||||
employer_custom_options = @setup.provider_section
|
||||
else
|
||||
employer_custom_options = IdCard::ProviderSection.new(title: "#{@employer.name} Custom")
|
||||
end
|
||||
@provider_options = (IdCard::ProviderSection.where(default: true) + [employer_custom_options])
|
||||
.compact.uniq.map { |option| [option.display_title, option.id || "99"] }
|
||||
@rx_options = IdCard::RxSection.where.not(title: nil)
|
||||
@rx_default = IdCard::RxSection.find_by(title: "FairosRx")
|
||||
render :index
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:id_card_setup]["provider_section_id"].include?("new|")
|
||||
new_provider_section_params = IdCard::ProviderSection.permitted_params(params)
|
||||
new_provider_section = IdCard::ProviderSection.create(new_provider_section_params)
|
||||
params[:id_card_setup]["provider_section_id"] = new_provider_section.id
|
||||
end
|
||||
setup_params = IdCard::Setup.permitted_params(params)
|
||||
if @setup.update(setup_params)
|
||||
puts "sucess"
|
||||
redirect_to employer_path(@employer.slug), notice: 'ID Card Setup was successfully updated.'
|
||||
else
|
||||
puts "fail"
|
||||
if @setup.provider_section.present? && !@setup.provider_section.default
|
||||
employer_custom_options = @setup.provider_section
|
||||
else
|
||||
employer_custom_options = IdCard::ProviderSection.new(title: "#{@employer.name} Custom")
|
||||
end
|
||||
@provider_options = (IdCard::ProviderSection.where(default: true) + [employer_custom_options])
|
||||
.compact.uniq.map { |option| [option.display_title, option.id || "99"] }
|
||||
@rx_options = IdCard::RxSection.all
|
||||
@rx_default = IdCard::RxSection.find_by(title: "FairosRx")
|
||||
render :index, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def plans
|
||||
@plan_templates = IdCard::Plan.templates
|
||||
render :plans
|
||||
end
|
||||
|
||||
def update_plans
|
||||
plans_params = IdCard::Plan.permitted_params(params)
|
||||
if @setup.update(plans_params)
|
||||
puts "sucess"
|
||||
redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Plans successfully updated.'
|
||||
else
|
||||
puts "fail"
|
||||
@plan_templates = IdCard::Plan.templates
|
||||
render :plans, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def field_exceptions
|
||||
render :field_exceptions
|
||||
end
|
||||
|
||||
def update_field_exceptions
|
||||
field_exceptions_params = IdCard::FieldException.permitted_params(params)
|
||||
if @setup.update(field_exceptions_params)
|
||||
puts "sucess"
|
||||
redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Exceptions successfully updated.'
|
||||
else
|
||||
puts "fail"
|
||||
render :field_exceptions, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def update_active_status
|
||||
@setup.active = !@setup.active
|
||||
if @setup.save
|
||||
puts "sucess"
|
||||
redirect_to employer_path(@setup.employer.slug), notice: 'ID Card Active Status successfully updated.'
|
||||
else
|
||||
puts "fail"
|
||||
render :show, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
end
|
||||
|
||||
# API Methods
|
||||
|
||||
private
|
||||
|
||||
def set_employer_and_setup
|
||||
@employer = Employer.find_by(slug: params[:employer_id])
|
||||
if @employer.id_card_setup.present?
|
||||
@setup = @employer.id_card_setup
|
||||
else
|
||||
@setup = @employer.create_id_card_setup
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
class ProviderGroupsController < ApplicationController
|
||||
before_action :set_provider_group, only: %i[ show edit update destroy ]
|
||||
|
||||
# GET /provider_groups or /provider_groups.json
|
||||
def index
|
||||
@provider_groups = ProviderGroup.all
|
||||
end
|
||||
|
||||
# GET /provider_groups/1 or /provider_groups/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /provider_groups/new
|
||||
def new
|
||||
@provider_group = ProviderGroup.new
|
||||
end
|
||||
|
||||
# GET /provider_groups/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /provider_groups or /provider_groups.json
|
||||
def create
|
||||
@provider_group = ProviderGroup.new(provider_group_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @provider_group.save
|
||||
format.html { redirect_to @provider_group, notice: "Provider group was successfully created." }
|
||||
format.json { render :show, status: :created, location: @provider_group }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.json { render json: @provider_group.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /provider_groups/1 or /provider_groups/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @provider_group.update(provider_group_params)
|
||||
format.html { redirect_to @provider_group, notice: "Provider group was successfully updated.", status: :see_other }
|
||||
format.json { render :show, status: :ok, location: @provider_group }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
format.json { render json: @provider_group.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /provider_groups/1 or /provider_groups/1.json
|
||||
def destroy
|
||||
@provider_group.destroy!
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to provider_groups_path, notice: "Provider group 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_provider_group
|
||||
@provider_group = ProviderGroup.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def provider_group_params
|
||||
params.require(:provider_group).permit(:name)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
class ProvidersController < ApplicationController
|
||||
before_action :set_provider, only: %i[ show edit update destroy ]
|
||||
|
||||
# GET /providers or /providers.json
|
||||
def index
|
||||
@providers = Provider.all
|
||||
end
|
||||
|
||||
# GET /providers/1 or /providers/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /providers/new
|
||||
def new
|
||||
@provider = Provider.new
|
||||
end
|
||||
|
||||
# GET /providers/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /providers or /providers.json
|
||||
def create
|
||||
@provider = Provider.new(provider_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @provider.save
|
||||
format.html { redirect_to @provider, notice: "Provider was successfully created." }
|
||||
format.json { render :show, status: :created, location: @provider }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.json { render json: @provider.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /providers/1 or /providers/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @provider.update(provider_params)
|
||||
format.html { redirect_to @provider, notice: "Provider was successfully updated.", status: :see_other }
|
||||
format.json { render :show, status: :ok, location: @provider }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
format.json { render json: @provider.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /providers/1 or /providers/1.json
|
||||
def destroy
|
||||
@provider.destroy!
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to providers_path, notice: "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_provider
|
||||
@provider = Provider.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def provider_params
|
||||
params.fetch(:provider, {})
|
||||
end
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
class WelcomeController < ApplicationController
|
||||
def index
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,114 @@
|
||||
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 = "flex bg-gray-200 rounded py-2 px-4 text-bluetang font-semibold leading-tight focus:outline-none focus:bg-white border border-platinum".freeze
|
||||
SELECT_FIELD_STYLE = "block bg-gray-200 text-bluetang py-2 px-4 font-semibold rounded leading-tight focus:outline-none focus:bg-white border border-platinum".freeze
|
||||
SUBMIT_BUTTON_STYLE = "cursor-pointer font-bold text-lg text-platinum hover:text-bronze bg-cobalt-vivid hover:bg-deepcove border-2 border-cobalt-vivid py-2 px-4 rounded".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)
|
||||
puts "classes: #{classes}"
|
||||
|
||||
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 justify-between"})
|
||||
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
|
||||
[object_method.to_s.titleize, {}]
|
||||
end
|
||||
|
||||
label_classes = label_opts[:class] || "block shrink-0 text-platinum font-bold md:text-right mb-1 md:mb-0 pr-4"
|
||||
label_classes += " dark:text-brightlava" 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-right text-bronze"}, options)
|
||||
end
|
||||
end
|
||||
|
||||
def border_color_classes(object_method)
|
||||
if errors_for(object_method).present?
|
||||
" border-4 dark:border-bronze focus:border-atmosphere"
|
||||
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
|
||||
@@ -1,2 +0,0 @@
|
||||
module ArticlesHelper
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
module BrokersHelper
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
module CarriersHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module CommentsHelper
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
module ProviderGroupsHelper
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
module ProvidersHelper
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
module WelcomeHelper
|
||||
end
|
||||
@@ -1,7 +1,16 @@
|
||||
// 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"
|
||||
import "controllers"
|
||||
// import { createIcons, icons } from "lucide-static";
|
||||
|
||||
// document.addEventListener("turbo:load", () => {
|
||||
// createIcons({ icons });
|
||||
// });
|
||||
|
||||
// const application = Application.start()
|
||||
// eagerLoadControllersFrom("controllers", application)
|
||||
|
||||
console.log('Hello World from application.js');
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static values = {
|
||||
formColor: { type: Array, default: [] } // Declares 'items' as an Array value
|
||||
}
|
||||
static targets = ["exceptionTemplate", "exceptionContainer", "exception", "exceptionButton"]
|
||||
|
||||
connect(){
|
||||
console.log(this.formColorValue)
|
||||
}
|
||||
|
||||
addExemption(event) {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
const content = this.#newExemption()
|
||||
|
||||
this.exceptionButtonTarget.insertAdjacentHTML('beforebegin', content);
|
||||
// this.containerTarget.insertAdjacentHTML("beforeend", content)
|
||||
}
|
||||
|
||||
removeExemption(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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#newExemption() {
|
||||
const nextIndex = this.exceptionTargets.length
|
||||
const num_of_colors = this.formColorValue.length
|
||||
let colorIndex = 0
|
||||
if (nextIndex != 0) {
|
||||
colorIndex = nextIndex % num_of_colors
|
||||
}
|
||||
const newColor = this.formColorValue[colorIndex]
|
||||
|
||||
return this.exceptionTemplateTarget.innerHTML
|
||||
.replace(/NEW_RECORD/g, nextIndex)
|
||||
.replace(/NEXT_COLOR/g, newColor)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["exceptionItemTemplate", "exceptionItemContainer", "exceptionItem", "exceptionItemButton"]
|
||||
|
||||
connect() {
|
||||
// if (this.exceptionItemTargets.length > 0) {
|
||||
// const content = this.#newExemptionItem()
|
||||
// this.exceptionItemButtonTarget.insertAdjacentHTML('beforebegin', content);
|
||||
// }
|
||||
}
|
||||
|
||||
addExemptionItem(event) {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
const content = this.#newExemptionItem()
|
||||
|
||||
this.exceptionItemButtonTarget.insertAdjacentHTML('beforebegin', content);
|
||||
// this.containerTarget.insertAdjacentHTML("beforeend", content)
|
||||
}
|
||||
|
||||
removeExemptionItem(event) {
|
||||
console.log("in remove")
|
||||
event.preventDefault();
|
||||
const wrapper = event.target.closest(".exception-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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#newExemptionItem() {
|
||||
const nextIndex = this.exceptionItemTargets.length
|
||||
console.log(nextIndex)
|
||||
const buttonElement = this.exceptionItemButtonTarget;
|
||||
|
||||
// Get the computed style (returns rgb/rgba value)
|
||||
const bgColor = window.getComputedStyle(buttonElement).backgroundColor;
|
||||
const newColor = `[${bgColor}]`
|
||||
|
||||
return this.exceptionItemTemplateTarget.innerHTML
|
||||
.replace(/NEW_ITEM_RECORD/g, nextIndex)
|
||||
.replace(/NEXT_COLOR/g, newColor)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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,55 @@
|
||||
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
|
||||
console.log(nextIndex)
|
||||
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,47 @@
|
||||
import { Controller } from "@hotwired/stimulus";
|
||||
|
||||
export default class extends Controller {
|
||||
static values = { url: String };
|
||||
static targets = ["benefit", "title"];
|
||||
|
||||
connect() {
|
||||
}
|
||||
|
||||
async fetchData(event) {
|
||||
const templateId = event.target.value;
|
||||
if (!templateId) {
|
||||
this.clearFields();
|
||||
return;
|
||||
}
|
||||
|
||||
const url = `/id_card/plans/${templateId}/get_plan_template`
|
||||
const response = await fetch(url);
|
||||
const templatePlanData = await response.json();
|
||||
|
||||
this.#updateFields(templatePlanData)
|
||||
}
|
||||
|
||||
clearFields() {
|
||||
}
|
||||
|
||||
async #updateFields(templatePlanData) {
|
||||
const titleElement = this.titleTarget
|
||||
if (!titleElement.value) {
|
||||
titleElement.value = templatePlanData.title.match(/^(.*\d)k(?=\d)/i)[0].replace(/(\d)/, ' $1')
|
||||
}
|
||||
const benefitTargetsList = this.benefitTargets
|
||||
templatePlanData.plan_benefits.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,57 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["dependentField", "providerField", "selectField"]
|
||||
|
||||
connect() {
|
||||
console.log("--- in toggle connect --- ")
|
||||
const selector = this.selectFieldTarget;
|
||||
if (selector.value) {
|
||||
const selectedValue = selector.value
|
||||
this.dependentFieldTargets.forEach((field) => {
|
||||
if (field.value) {
|
||||
if (selectedValue == "network_logo") {
|
||||
field.parentElement.parentElement.parentElement.classList.remove("hidden");
|
||||
} else {
|
||||
field.parentElement.classList.remove("hidden");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
toggleFields() {
|
||||
console.log("--- in toggle --- ")
|
||||
const selector = this.selectFieldTarget;
|
||||
if (selector.value) {
|
||||
const selectedValue = selector.value
|
||||
this.field_match = false;
|
||||
this.dependentFieldTargets.forEach((field) => {
|
||||
// console.log("- ", selectedValue)
|
||||
// console.log("-- ", this.field_match)
|
||||
// Check a data attribute on the field to see if it matches the selected value
|
||||
if (field.dataset.parentValue === selectedValue) {
|
||||
if (selectedValue == "network_logo") {
|
||||
field.parentElement.parentElement.parentElement.classList.remove("hidden");
|
||||
} else {
|
||||
field.parentElement.classList.remove("hidden");
|
||||
}
|
||||
this.field_match = true;
|
||||
} else {
|
||||
if (field.dataset.parentValue == "network_logo") {
|
||||
field.parentElement.parentElement.parentElement.classList.add("hidden");
|
||||
} else {
|
||||
field.parentElement.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!this.field_match) {
|
||||
console.log("--- ", this.field_match)
|
||||
const defaultOption = this.dependentFieldTargets.find(target => {
|
||||
return target.dataset.parentValue === 'default';
|
||||
});
|
||||
defaultOption.parentElement.classList.remove("hidden");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// app/javascript/controllers/font_validator_controller.js
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["textField", "hiddenField", "countDisplayField"]
|
||||
|
||||
connect() {
|
||||
this.measure()
|
||||
}
|
||||
|
||||
measure() {
|
||||
const text = this.textFieldTarget.value
|
||||
const pixelWidth = this.getTextWidth(text, "bold 6px sans-serif")
|
||||
|
||||
// Do something with the pixel width (e.g., store in a hidden field for Rails to read)
|
||||
if (this.hasHiddenFieldTarget) {
|
||||
this.hiddenFieldTarget.value = pixelWidth
|
||||
this.countDisplayFieldTarget.textContent = `${pixelWidth}`
|
||||
if (pixelWidth > 100) {
|
||||
this.countDisplayFieldTarget.classList.add("text-brightlava")
|
||||
} else {
|
||||
this.countDisplayFieldTarget.classList.remove("text-brightlava")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Canvas measurement trick
|
||||
getTextWidth(text, font) {
|
||||
const canvas = document.createElement("canvas")
|
||||
const context = canvas.getContext("2d")
|
||||
context.font = font
|
||||
const metrics = context.measureText(text)
|
||||
return Math.ceil(metrics.width)
|
||||
}
|
||||
}
|
||||
@@ -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,112 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["dependentField", "providerField", "selectField"]
|
||||
|
||||
connect() {
|
||||
if (this.selectFieldTarget.value) {
|
||||
this.toggleNewFieldSection();
|
||||
}
|
||||
}
|
||||
|
||||
async initNewFieldSection() {
|
||||
console.log("--- in init async --- ")
|
||||
const selector = this.selectFieldTarget
|
||||
console.log(selector.textContent)
|
||||
console.log(selector.value)
|
||||
if (selector && selector.value && !selector.textContent.includes("Default")) {
|
||||
const sectionId = selector.value
|
||||
|
||||
const response = await fetch(`/id_card/provider_sections/${sectionId}/get_section_data`);
|
||||
const templateSectionData = await response.json();
|
||||
|
||||
this.#updateFields(templateSectionData)
|
||||
|
||||
this.dependentFieldTarget.classList.remove("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
async toggleNewFieldSection() {
|
||||
console.log("--- in new field toggle --- ")
|
||||
const selector = this.selectFieldTarget
|
||||
const selectedOption = selector.options[selector.selectedIndex]
|
||||
const selectedValue = selectedOption.value
|
||||
const selectedLabel = selectedOption.textContent
|
||||
|
||||
if (selectedValue && selectedLabel.includes("Default")) {
|
||||
this.dependentFieldTarget.classList.add("hidden");
|
||||
} else if (selectedValue) {
|
||||
let sectionId = selectedValue
|
||||
if (selectedValue.includes("new")) {
|
||||
sectionId = selectedValue.split('|')[1]
|
||||
}
|
||||
const response = await fetch(`/id_card/provider_sections/${sectionId}/get_section_data`);
|
||||
const sectionData = await response.json();
|
||||
|
||||
this.#updateFields(sectionData)
|
||||
|
||||
this.dependentFieldTarget.classList.remove("hidden");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async #updateFields(templateSectionData) {
|
||||
const providerFieldTargetsList = this.providerFieldTargets
|
||||
console.log(templateSectionData)
|
||||
providerFieldTargetsList.forEach(function(formField) {
|
||||
const dbField = formField.id.replace('id_card_setup_provider_section_', '')
|
||||
const dbValue = templateSectionData[dbField]
|
||||
formField.value = dbValue;
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
// templateSectionData.forEach(function(data) {
|
||||
// const targetElement = providerFieldTargetsList.find(
|
||||
// (element) => element.dataset.sequence == data.sequence
|
||||
// );
|
||||
// if (targetElement) {
|
||||
// targetElement.value = data.benefit;
|
||||
// } else {
|
||||
// console.error(`Target not found for sequence: ${data.sequence}`);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
toggleFields() {
|
||||
console.log("--- in toggle --- ")
|
||||
const selector = this.element.querySelector('[data-action*="change->general-form#toggleFields"]');
|
||||
if (selector) {
|
||||
const selectedValue = selector.value
|
||||
this.field_match = false;
|
||||
this.dependentFieldTargets.forEach((field) => {
|
||||
// Check a data attribute on the field to see if it matches the selected value
|
||||
if (field.dataset.parentValue === selectedValue) {
|
||||
if (selectedValue == "network_logo") {
|
||||
field.parentElement.parentElement.classList.remove("hidden");
|
||||
} else {
|
||||
field.parentElement.classList.remove("hidden");
|
||||
}
|
||||
this.field_match = true;
|
||||
console.log("- ", selectedValue)
|
||||
console.log("-- ", this.field_match)
|
||||
} else {
|
||||
if (field.dataset.parentValue == "network_logo") {
|
||||
field.parentElement.parentElement.classList.add("hidden");
|
||||
} else {
|
||||
field.parentElement.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!this.field_match) {
|
||||
console.log("--- ", this.field_match)
|
||||
const defaultOption = this.dependentFieldTargets.find(target => {
|
||||
return target.dataset.parentValue === 'default';
|
||||
});
|
||||
defaultOption.parentElement.classList.remove("hidden");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "name", "output" ]
|
||||
|
||||
connect() {
|
||||
// this.element.textContent = "Hello World!"
|
||||
console.log('Hello World hello_controller.js');
|
||||
}
|
||||
|
||||
greet() {
|
||||
console.log('greet');
|
||||
this.outputTarget.textContent =
|
||||
`Hello, ${this.nameTarget.value}!`
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
// Import and register all your controllers from the importmap under controllers/*
|
||||
|
||||
// This file is auto-generated by ./bin/rails stimulus:manifest:update
|
||||
// Run that command whenever you add a new controller or create them with
|
||||
// ./bin/rails generate stimulus controllerName
|
||||
import { application } from "controllers/application"
|
||||
|
||||
// Eager load all controllers defined in the import map under controllers/**/*_controller
|
||||
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
|
||||
eagerLoadControllersFrom("controllers", application)
|
||||
|
||||
// Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
|
||||
// import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
|
||||
// lazyLoadControllersFrom("controllers", application)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = [ "selector", "link" ]
|
||||
static values = { urlTemplate: String } // Pass template like "/users/:id/edit"
|
||||
|
||||
update() {
|
||||
console.log("## ## %%")
|
||||
const selectedId = this.selectorTarget.value
|
||||
// Replace placeholder with selected ID
|
||||
const newUrl = this.urlTemplateValue.replace(":id", selectedId)
|
||||
|
||||
// Update the link href
|
||||
this.linkTarget.href = newUrl
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
import { Controller } from "@hotwired/stimulus";
|
||||
|
||||
export default class extends Controller {
|
||||
static values = {
|
||||
logoType: String,
|
||||
employerName: String,
|
||||
employerId: Number
|
||||
}
|
||||
static targets = ["preview", "previewContainer", "logoSelect", "logoIdField", "logoNameField", "initialLogoFile"];
|
||||
|
||||
async connect() {
|
||||
console.log('in connect');
|
||||
this.setPreviewImage()
|
||||
// Remember to revoke the URL when the controller is disconnected if necessary
|
||||
// this.disconnect = () => URL.revokeObjectURL(objectUrl);
|
||||
}
|
||||
|
||||
async setPreviewImage() {
|
||||
const initValue = this.logoIdFieldTarget.value
|
||||
console.log(initValue)
|
||||
console.log(this.logoTypeValue)
|
||||
if (initValue) {
|
||||
const response = await fetch(`/id_card/${this.logoTypeValue}_logos/${initValue}/image`); // Fetch the binary data
|
||||
const logoType = this.logoTypeValue
|
||||
if (logoType == "employer") {
|
||||
const contentDisposition = response.headers.get('Content-Disposition');
|
||||
const filename = contentDisposition.match(/filename="?([^"]+)"?/)[1];
|
||||
this.logoNameFieldTarget.value = filename;
|
||||
}
|
||||
const blob = await response.blob();
|
||||
const objectUrl = URL.createObjectURL(blob);
|
||||
this.previewTarget.src = objectUrl;
|
||||
this.previewContainerTarget.classList.remove("hidden");
|
||||
} else {
|
||||
this.previewContainerTarget.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
setSelectPreview(event) {
|
||||
this.setPreviewImage()
|
||||
}
|
||||
|
||||
uploadLogo(event) {
|
||||
console.log('in uploadLogo');
|
||||
event.preventDefault()
|
||||
let logoFile = event.target.files[0];
|
||||
if (!logoFile) return;
|
||||
|
||||
const logoType = this.logoTypeValue
|
||||
|
||||
let newFileName = logoFile.name
|
||||
if (logoType == "network") {
|
||||
console.log("n " + newFileName);
|
||||
newFileName = this.determineNetworkFilename(logoFile)
|
||||
} else if (logoType == "employer") {
|
||||
newFileName = this.determineEmployerFilename(logoFile)
|
||||
}
|
||||
logoFile = new File([logoFile], newFileName)
|
||||
|
||||
this.uploadLogoToServer(logoFile)
|
||||
.then((result) => {
|
||||
console.log(result);
|
||||
const logoId = result.id
|
||||
this.previewFile(logoFile);
|
||||
if (logoType == "network") {
|
||||
this.addOptionToSelect(newFileName, logoId)
|
||||
} else {
|
||||
this.logoNameFieldTarget.value = newFileName;
|
||||
}
|
||||
|
||||
this.logoIdFieldTarget.value = logoId;
|
||||
|
||||
|
||||
})
|
||||
.catch((error) => {
|
||||
// Handle any errors that occurred
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
previewFile(logoFile) {
|
||||
console.log('in previewFile');
|
||||
const reader = new FileReader();
|
||||
reader.onload = (e) => {
|
||||
this.previewTarget.src = e.target.result;
|
||||
this.previewContainerTarget.classList.remove("hidden");
|
||||
};
|
||||
reader.readAsDataURL(logoFile);
|
||||
}
|
||||
|
||||
async uploadLogoToServer(logoFile) {
|
||||
console.log('in uploadLogoToServer');
|
||||
const employerId = this.employerIdValue
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append(`id_card_${this.logoTypeValue}_logo[logo_file]`, logoFile);
|
||||
if (employerId) {
|
||||
formData.append(`id_card_${this.logoTypeValue}_logo[employer_id]`, employerId);
|
||||
}
|
||||
|
||||
const csrfToken = document.querySelector("meta[name='csrf-token']").content;
|
||||
|
||||
try {
|
||||
const response = await fetch(`/id_card/${this.logoTypeValue}_logos/`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-CSRF-Token": csrfToken
|
||||
},
|
||||
body: formData
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
console.log('Upload successful!')
|
||||
const data = await response.json();
|
||||
return data;
|
||||
} else {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Network error:", error);
|
||||
throw new Error("Network error:", error);
|
||||
}
|
||||
}
|
||||
|
||||
addOptionToSelect(name, id) {
|
||||
const blankOptionIndex = 0;
|
||||
const newOption = new Option(name, id, true, true)
|
||||
|
||||
if (this.logoIdFieldTarget.options.length > blankOptionIndex + 1) {
|
||||
this.logoIdFieldTarget.insertBefore(newOption, this.logoIdFieldTarget.options[blankOptionIndex + 1]);
|
||||
} else {
|
||||
this.logoIdFieldTarget.appendChild(newOption);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
determineNetworkFilename(logoFile) {
|
||||
const fileExtension = logoFile.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 partner network (ex: Health Partners):");
|
||||
const logoFilename = this.titleizeText(primaryNetworkName).concat(this.titleizeText(secondaryNetworkName)).concat("Logo.").concat(fileExtension).replaceAll(' ', '');
|
||||
|
||||
return logoFilename
|
||||
}
|
||||
|
||||
determineEmployerFilename(logoFile) {
|
||||
const fileExtension = logoFile.name.split('.').pop();
|
||||
const employerName = this.employerNameValue
|
||||
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,25 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["providerNetworkField", "networkLogoField", "providerSectionField"]
|
||||
|
||||
connect() {
|
||||
console.log("---provider update---")
|
||||
}
|
||||
|
||||
syncDefaults() {
|
||||
const pnValue = this.providerNetworkFieldTarget.value
|
||||
if (pnValue == "Cigna") {
|
||||
this.networkLogoFieldTarget.value = 9
|
||||
this.providerSectionFieldTarget.value = 5
|
||||
} else if (pnValue == "MedCost") {
|
||||
this.networkLogoFieldTarget.value = 7
|
||||
this.providerSectionFieldTarget.value = 4
|
||||
} else {
|
||||
this.networkLogoFieldTarget.value = ""
|
||||
this.providerSectionFieldTarget.value = ""
|
||||
}
|
||||
const event = new Event('change', { bubbles: true });
|
||||
this.networkLogoFieldTarget.dispatchEvent(event);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
class ProcessMemberCardDataJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(member_key, member_card_exceptions_attrs, has_divisions = false, has_dental = false)
|
||||
member = Member.find_by(pb_entity_key: member_key)
|
||||
|
||||
effect_date = determine_eff_date(member)
|
||||
if effect_date
|
||||
member_card = @base_card.dup
|
||||
member_attributes = {
|
||||
full_name: member.id_card_display_name,
|
||||
full_name_last_name_first: member.name,
|
||||
primary_mb_member_key: member.pb_entity_key,
|
||||
family_id: member.family_id,
|
||||
plan_id: member.id_card_plan_id,
|
||||
medical_eff_date: effect_date.strftime("%m/%d/%Y")
|
||||
}
|
||||
|
||||
if member.dependents.present?
|
||||
dependent_attributes = format_dependent_attributes(member)
|
||||
member_attributes.merge!(dependent_attributes)
|
||||
end
|
||||
|
||||
if has_divisions
|
||||
member_attributes.merge!({employer_name: member.division})
|
||||
end
|
||||
|
||||
if member_card_exceptions_attrs.present?
|
||||
# exceptions_attributes = {}
|
||||
# field_exceptions = IdCard::FieldException.where(id: field_exception_ids)
|
||||
# member_exception_values = member.id_card_field_exception_values
|
||||
# field_exceptions.each do |fe|
|
||||
# if fe.exception_values.include?(member_exception_values[fe.exception_type.to_sym])
|
||||
# fe.field_exception_items.each do |fei|
|
||||
# if fei.field_value.present?
|
||||
# exception_eff_date = Date.strptime(fei.field_value, "%m/%d/%Y")
|
||||
# member_eff_date = Date.strptime(member_attributes[:medical_eff_date], "%m/%d/%Y")
|
||||
# if exception_eff_date > member_eff_date
|
||||
# exceptions_attributes[fei.field_name.to_sym] = fei.field_value
|
||||
# end
|
||||
# elsif fei.provider_section_id.present?
|
||||
# provider_attributes = IdCard::ProviderSection.find(fei.provider_section_id).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
|
||||
# )
|
||||
# exceptions_attributes.merge!(provider_attributes)
|
||||
# elsif fei.network_logo_id.present?
|
||||
# exceptions_attributes.merge!(network_logo_filename: fei.network_logo.filename)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
member_attributes.merge!(member_card_exceptions_attrs)
|
||||
end
|
||||
|
||||
if has_dental
|
||||
member_attributes.merge!({dental_coverage: member.coverage_class.upcase})
|
||||
if member.dental_plan_key && member.id_card_plan_id.blank?
|
||||
member_attributes.merge!({group_number: "", medical_eff_date: ""})
|
||||
# dental_plan = IdCard::Plan.find_by(pb_product_key: 1025)
|
||||
if IdCard::Plan.find_by(pb_product_key: member.dental_plan_key).blank?
|
||||
member_attributes.merge!({employer_name: 'COBRA'})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if member.id_card_plan.present? && member.id_card_plan.title.upcase.include?('COBRA')
|
||||
member_attributes.merge!({employer_name: 'COBRA'})
|
||||
end
|
||||
|
||||
if member.id_card_plan_id.present?
|
||||
member_card = IdCard::PrintData.find_by(pl_plan_key: member.pl_plan_key, plan_id: member.id_card_plan_id, primary_mb_member_key: nil).dup
|
||||
else
|
||||
member_card = IdCard::PrintData.where(pl_plan_key: member.pl_plan_key, primary_mb_member_key: nil).first.dup
|
||||
end
|
||||
|
||||
member_card.assign_attributes(member_attributes)
|
||||
member_card.save
|
||||
# if dependent_attributes.present?
|
||||
# dependent_card = member_card.dup
|
||||
# dependent_card.full_name_last_name_first = dependent_card.full_name_last_name_first.concat(" dependent")
|
||||
# dependent_card.save
|
||||
# end
|
||||
end
|
||||
|
||||
true
|
||||
|
||||
# BatchProcess.increment_counter(:completed_jobs, batch_process_id)
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def determine_eff_date(member)
|
||||
participation = Vhcs::PbProductParticipation.joins('INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"').where('"PBCoveredEntities"."PBEntityKey" = ?', member.pb_entity_key).order(out_of_effect: :desc).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 format_dependent_attributes(member)
|
||||
dependent_attributes = {}
|
||||
member.dependents.each_with_index do |dep, index|
|
||||
dependent_attributes["dependent_#{index + 1}".to_sym] = dep
|
||||
end
|
||||
dependent_attributes
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,150 @@
|
||||
class UpdateEmployerJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(employer_identifier: {}, employer_plan_header: {}, full_sync: false)
|
||||
|
||||
if employer_plan_header.present?
|
||||
pl_plan_key = employer_plan_header['PLPlanKey'].to_s
|
||||
employer_identifier[:pl_plan_key] = pl_plan_key
|
||||
elsif employer_identifier[:group_number]
|
||||
group_number = employer_identifier[:group_number]
|
||||
pl_plan_key = Vhcs::PlPlanGroupCode.find_by(group_code: group_number).pl_plan_key
|
||||
elsif employer_identifier[:pl_plan_key]
|
||||
pl_plan_key = employer_identifier[:pl_plan_key]
|
||||
end
|
||||
|
||||
if pl_plan_key.present?
|
||||
|
||||
if employer_plan_header.empty?
|
||||
sql_query = "SELECT PLPlanKey, PlanId, ShortDesc FROM PLPlanHeader WHERE PLPlanKey = #{pl_plan_key}"
|
||||
employer_plan_header = VhcsRecord.connection.select_all(sql_query).first
|
||||
end
|
||||
|
||||
puts "== Updating #{employer_plan_header['ShortDesc'].strip.titleize} =="
|
||||
|
||||
plan_code = Vhcs::HlPlanCode.find_by(plan_key: pl_plan_key)
|
||||
pb_company_plan = Vhcs::PbCompanyPlans.find_by(pl_plan_key: pl_plan_key)
|
||||
employer = Employer.find_or_create_by(employer_identifier)
|
||||
id_card_setup = employer.id_card_setup || employer.build_id_card_setup(pl_plan_key: employer.pl_plan_key)
|
||||
full_sync = employer.previously_new_record? || full_sync
|
||||
unless group_number.present?
|
||||
group_number = Vhcs::PlPlanGroupCode.find_by(pl_plan_key: pl_plan_key).group_code
|
||||
end
|
||||
|
||||
employer_update_attrs = {}
|
||||
employer_update_attrs.merge!({
|
||||
plan_id: employer_plan_header['PlanId'].strip.to_i,
|
||||
company_pb_entity_key: pb_company_plan.company_pb_entity_key,
|
||||
group_number: group_number,
|
||||
pl_plan_key: pl_plan_key
|
||||
})
|
||||
|
||||
if plan_code.present? && employer.effective_date.blank?
|
||||
employer_update_attrs.merge!({
|
||||
effective_date: plan_code.effect_date.strftime("%m/%d/%Y")
|
||||
})
|
||||
end
|
||||
|
||||
if full_sync && employer.name.blank?
|
||||
employer_update_attrs.merge!({
|
||||
name: employer_plan_header['ShortDesc'].strip.titleize
|
||||
})
|
||||
end
|
||||
|
||||
employer.assign_attributes(employer_update_attrs)
|
||||
if !employer.save && full_sync
|
||||
employer.save(validate: false)
|
||||
end
|
||||
|
||||
if !employer.initialized && [employer.pl_plan_key, employer.group_number, employer.company_pb_entity_key, employer.plan_id].all?(&:present?)
|
||||
employer.update(active: true)
|
||||
end
|
||||
|
||||
setup_update_attrs = {}
|
||||
if plan_code.present? && id_card_setup.rx_group_number.blank?
|
||||
setup_update_attrs.merge!({
|
||||
rx_group_number: plan_code.medical_number
|
||||
})
|
||||
end
|
||||
|
||||
if full_sync || id_card_setup.print_name.blank?
|
||||
setup_update_attrs.merge!({
|
||||
print_name: determine_card_print_name(pb_company_plan.company_pb_entity_key, pl_plan_key)
|
||||
})
|
||||
end
|
||||
|
||||
if id_card_setup.pl_plan_key.blank? && employer.pl_plan_key.present?
|
||||
setup_update_attrs.merge!({
|
||||
pl_plan_key: employer.pl_plan_key
|
||||
})
|
||||
end
|
||||
|
||||
id_card_setup.assign_attributes(setup_update_attrs)
|
||||
if !id_card_setup.save && full_sync
|
||||
id_card_setup.save(validate: false)
|
||||
end
|
||||
|
||||
# plan_code = Vhcs::HlPlanCode.find_by(plan_key: employer.pl_plan_key)
|
||||
# employer.group_number = plan_code.group_number
|
||||
# id_card_setup.rx_group_number = plan_code.medical_number
|
||||
# employer.effective_date = plan_code.effect_date.strftime("%m/%d/%Y")
|
||||
|
||||
# pb_company_plan = Vhcs::PbCompanyPlans.find_by(pl_plan_key: employer.pl_plan_key)
|
||||
# employer.company_pb_entity_key = pb_company_plan.company_pb_entity_key
|
||||
|
||||
# card_print_name = Vhcs::PbEntity.where(company_pb_entity_key: employer.company_pb_entity_key, entity_type_id: 1007).last.last_name
|
||||
# id_card_setup.print_name = card_print_name
|
||||
|
||||
# if employer.up_to_date?
|
||||
# employer.active = true
|
||||
# end
|
||||
|
||||
# employer.default_network_logo = determine_network_logos(employer.pl_plan_key)
|
||||
|
||||
# plan_codes = Vhcs::HlEgglestonCardBenefit.where(plan_key: employer.pl_plan_key).pluck(:plan_id).uniq
|
||||
# employer_plans = employer.id_card_setup.plans
|
||||
# plan_titles = employer_plans.pluck(:title)
|
||||
# vhcs_plans = Vhcs::PbProduct.where(company_pb_entity_key: pb_company_plan.company_pb_entity_key, is_active: 255)
|
||||
# vhcs_plans.each do |vp|
|
||||
# if employer_plans.present? && plan_titles.all?(&:present?) && employer_plans.find_by(pb_product_key: vp.pb_product_key).nil?
|
||||
# plan_title_matcher = Amatch::JaroWinkler.new(vp.short_description)
|
||||
# closest_title = plan_titles.max_by { |title| plan_title_matcher.match(title) }
|
||||
# plan = employer_plans.find_or_create_by(title: closest_title)
|
||||
# plan.update(
|
||||
# title: vp.short_description,
|
||||
# pb_product_key: vp.pb_product_key,
|
||||
# pl_plan_key: employer.pl_plan_key
|
||||
# )
|
||||
# plan_titles.delete(closest_title)
|
||||
# elsif employer_plans.blank?
|
||||
# employer_plans.create!(
|
||||
# pb_product_key: vp.pb_product_key,
|
||||
# title: vp.short_description,
|
||||
# pl_plan_key: employer.pl_plan_key
|
||||
# )
|
||||
# # plan.update(
|
||||
# # title: vp.short_description,
|
||||
# # pl_plan_key: employer.pl_plan_key
|
||||
# # )
|
||||
# end
|
||||
# end
|
||||
|
||||
end
|
||||
employer.presence
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def determine_card_print_name(company_pb_entity_key, pl_plan_key)
|
||||
card_print_names = Vhcs::PbEntity.where(company_pb_entity_key: company_pb_entity_key, entity_type_id: 1007)
|
||||
.where.not("LastName LIKE ? OR LastName LIKE ? OR LastName LIKE ?", "%COBRA%", "Active", ".%").pluck(:last_name)
|
||||
if pl_plan_key == "2"
|
||||
"sm ART"
|
||||
elsif card_print_names.count > 2
|
||||
Employer.employer_trim_name(card_print_names.first)
|
||||
else
|
||||
card_print_names.last
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,67 @@
|
||||
class UpdateEmployerPlansJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(pl_plan_key)
|
||||
|
||||
employer = Employer.includes(:id_card_setup).find_by(pl_plan_key: pl_plan_key)
|
||||
setup = employer.id_card_setup
|
||||
puts "== Updating #{employer.name} Plans =="
|
||||
|
||||
pb_company_plan = Vhcs::PbCompanyPlans.find_by(pl_plan_key: pl_plan_key)
|
||||
|
||||
vhcs_card_plans = Vhcs::PbProduct.where(company_pb_entity_key: pb_company_plan.company_pb_entity_key, is_active: 255).where.not("ShortDescription LIKE ?", "%Vision%")
|
||||
unless setup.has_dental
|
||||
vhcs_card_plans = vhcs_card_plans.where.not("ShortDescription LIKE ?", "%Dental%")
|
||||
end
|
||||
vhcs_card_plan_product_keys = vhcs_card_plans.pluck(:pb_product_key)
|
||||
vhcs_card_plan_titles = vhcs_card_plans.pluck(:short_description).map(&:strip)
|
||||
|
||||
employer_plans = employer.id_card_setup.plans
|
||||
employer_plan_product_keys = employer_plans.pluck(:pb_product_key)
|
||||
employer_plan_titles = employer_plans.pluck(:title)
|
||||
plans_without_product_key = employer_plans.where(pb_product_key: ["", nil])
|
||||
|
||||
new_card_plan_pb_product_keys = vhcs_card_plan_product_keys - employer_plan_product_keys
|
||||
|
||||
vhcs_card_plans_to_import = Vhcs::PbProduct.where(pb_product_key: new_card_plan_pb_product_keys)
|
||||
vhcs_card_plans_to_import.each do |vhcs_plan_import|
|
||||
# if employer_plans.present? && plan_titles.all?(&:present?) && employer_plans.find_by(pb_product_key: vhcs_plan.pb_product_key).nil?
|
||||
# if employer_plans.find_by(pb_product_key: vhcs_plan.pb_product_key).nil?
|
||||
|
||||
if plans_without_product_key
|
||||
plan_title_matcher = Amatch::JaroWinkler.new(vhcs_plan_import.short_description.strip)
|
||||
title_match = employer_plan_titles.max_by { |title| plan_title_matcher.match(title) }
|
||||
plan = employer_plans.find_or_create_by(title: title_match)
|
||||
plan.update(
|
||||
pb_product_key: vhcs_plan_import.pb_product_key,
|
||||
title: vhcs_plan_import.short_description.strip,
|
||||
pl_plan_key: employer.pl_plan_key
|
||||
)
|
||||
employer_plan_titles.delete(title_match)
|
||||
else
|
||||
employer_plans.create!(
|
||||
pb_product_key: vhcs_plan_import.pb_product_key,
|
||||
title: vhcs_plan_import.short_description.strip,
|
||||
pl_plan_key: employer.pl_plan_key
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
employer
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def determine_card_print_name(company_pb_entity_key, pl_plan_key)
|
||||
card_print_names = Vhcs::PbEntity.where(company_pb_entity_key: company_pb_entity_key, entity_type_id: 1007)
|
||||
.where.not("LastName LIKE ? OR LastName LIKE ? OR LastName LIKE ?", "%COBRA%", "Active", ".%").pluck(:last_name)
|
||||
if pl_plan_key == "2"
|
||||
"sm ART"
|
||||
elsif card_print_names.count > 2
|
||||
Employer.employer_trim_name(card_print_names.first)
|
||||
else
|
||||
card_print_names.last
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,109 @@
|
||||
class UpdateMemberJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(pb_entity_key, employer_id, has_divisions = false, has_dental = false, vw_mb_member = {})
|
||||
|
||||
unless vw_mb_member.present?
|
||||
vw_mb_member = Vhcs::VwmbMember.find_by(enrollee_type_value_id: 1, pb_entity_key: pb_entity_key).attributes.with_indifferent_access.slice(:mb_member_key, :pb_entity_key, :pl_plan_key, :family_id, :full_name_last_name_first, :social_security_number)
|
||||
end
|
||||
|
||||
pb_products = Vhcs::PbProduct.joins('
|
||||
INNER JOIN "PBProductAvailability" ON "PBProductAvailability"."PBProductKey" = "PBProduct"."PBProductKey"
|
||||
INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."PBProductAvailabilityKey" = "PBProductAvailability"."PBProductAvailabilityKey"
|
||||
INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"
|
||||
').where('
|
||||
"PBCoveredEntities"."PBEntityKey" = ?
|
||||
AND "PBProductParticipation"."InEffect" <= ?
|
||||
AND "PBProductParticipation"."OutOfEffect" > ?',
|
||||
vw_mb_member[:pb_entity_key], 3.month.from_now , 1.day.ago
|
||||
)
|
||||
|
||||
if pb_products.present? && vw_mb_member[:social_security_number].present?
|
||||
member = Member.find_or_create_by(pb_entity_key: vw_mb_member[:pb_entity_key], employer_id: employer_id)
|
||||
member.name = vw_mb_member[:full_name_last_name_first].titleize
|
||||
member.mb_member_key = vw_mb_member[:mb_member_key]
|
||||
member.family_id = vw_mb_member[:family_id]
|
||||
member.pl_plan_key = vw_mb_member[:pl_plan_key]
|
||||
|
||||
card_display_name = Vhcs::PbEntity.find_by(pb_entity_key: member.pb_entity_key).full_name
|
||||
member.id_card_display_name = card_display_name
|
||||
|
||||
if has_divisions
|
||||
division = Vhcs::PbEntity.joins('
|
||||
INNER JOIN "PBAffiliation" ON "PBAffiliation"."ParentPBEntityKey" = "PBEntity"."PBEntityKey"
|
||||
INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."PBAffiliationKey" = "PBAffiliation"."PBAffiliationKey"
|
||||
INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"
|
||||
').find_by('
|
||||
"PBCoveredEntities"."PBEntityKey" = ?
|
||||
AND "PBProductParticipation"."OutOfEffect" > ?',
|
||||
member.pb_entity_key, 1.day.ago
|
||||
).last_name
|
||||
member.division = division
|
||||
end
|
||||
|
||||
if has_dental
|
||||
medical_pb_product_key = pb_products.where("ShortDescription LIKE ?", "%Medical%")&.first&.pb_product_key
|
||||
dental_pb_product_key = pb_products.where("ShortDescription LIKE ?", "%Dental%")&.first&.pb_product_key
|
||||
# dental_pb_product_key = pb_products.where(short_description: "Dental")&.first&.pb_product_key
|
||||
if dental_pb_product_key
|
||||
member.dental_plan_key = dental_pb_product_key
|
||||
|
||||
coverage_class = Vhcs::GenLookupTables.joins('
|
||||
INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."CoverageTypeCode" = "GEN_LookupTables"."RecordID"
|
||||
INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"
|
||||
INNER JOIN "PBProductAvailability" ON "PBProductAvailability"."PBProductAvailabilityKey" = "PBProductParticipation"."PBProductAvailabilityKey"
|
||||
INNER JOIN "PBProduct" ON "PBProduct"."PBProductKey" = "PBProductAvailability"."PBProductKey"
|
||||
').select('
|
||||
"GEN_LookupTables".*, "PBProductParticipation"."InEffect" AS EffDate
|
||||
').where('
|
||||
"PBCoveredEntities"."PBEntityKey" = ?
|
||||
AND "PBProductParticipation"."InEffect" <= ?
|
||||
AND "PBProductParticipation"."OutOfEffect" > ?
|
||||
AND "PBProduct"."PBProductKey" = ?',
|
||||
member.pb_entity_key, 1.month.from_now, 1.day.ago, dental_pb_product_key
|
||||
).order('EffDate DESC').first.short_desc
|
||||
member.coverage_class = coverage_class
|
||||
else
|
||||
member.coverage_class = "NONE"
|
||||
end
|
||||
else
|
||||
medical_pb_product_key = pb_products.first.pb_product_key
|
||||
end
|
||||
if medical_pb_product_key && plan = IdCard::Plan.find_by(pb_product_key: medical_pb_product_key)
|
||||
member.id_card_plan = plan
|
||||
end
|
||||
member.dependents = get_dependent_names_by_sequence(member)
|
||||
# if employer_members_update
|
||||
# member
|
||||
# else
|
||||
|
||||
# end
|
||||
member.save!
|
||||
puts "---- #{member.name}"
|
||||
end
|
||||
member.presence
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_dependent_names_by_sequence(member)
|
||||
dependents = Vhcs::VwmbMember.joins('
|
||||
INNER JOIN "PBCoveredEntities" ON "PBCoveredEntities"."PBEntityKey" = "vwMBMember"."PBEntityKey"
|
||||
INNER JOIN "PBProductParticipation" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"
|
||||
INNER JOIN "PBProductAvailability" ON "PBProductAvailability"."PBProductAvailabilityKey" = "PBProductParticipation"."PBProductAvailabilityKey"
|
||||
INNER JOIN "PBProduct" ON "PBProduct"."PBProductKey" = "PBProductAvailability"."PBProductKey"
|
||||
').where('
|
||||
"EnrolleeTypeKey" != 1044 AND "PLPlanKey" = ? AND "PBProductParticipation"."OutOfEffect" >= ? AND "FamilyID" = ?', member.pl_plan_key, Date.today.strftime("%m/%d/%Y"), member.family_id
|
||||
)
|
||||
if member.pl_plan_key == 3
|
||||
dependents = dependents.where('"PBProduct"."PBProductKey" != 1024')
|
||||
elsif member.pl_plan_key == 2
|
||||
dependents = dependents.where('"PBProduct"."PBProductKey" != 1019')
|
||||
end
|
||||
dependent_names = dependents.order(:sequence_number).map { |dep| dep.first_name + ' ' + dep.last_name}.uniq
|
||||
dependent_names
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -2,4 +2,6 @@
|
||||
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
primary_abstract_class
|
||||
|
||||
establish_connection :primary
|
||||
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,5 @@
|
||||
class BatchProcess < ApplicationRecord
|
||||
|
||||
|
||||
|
||||
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 Broker < ApplicationRecord
|
||||
belongs_to :carrier
|
||||
has_many :employers
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class Carrier < ApplicationRecord
|
||||
has_many :brokers
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
class Comment < ApplicationRecord
|
||||
belongs_to :article
|
||||
broadcasts_to :article
|
||||
end
|
||||
@@ -0,0 +1,103 @@
|
||||
module EmployerAutomation
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
|
||||
scope :uninitialized, -> {
|
||||
where(initialized: false)
|
||||
}
|
||||
|
||||
scope :initialized, -> {
|
||||
where(initialized: true)
|
||||
}
|
||||
|
||||
scope :not_automation_ready, -> {
|
||||
where(group_number: [nil, ''])
|
||||
}
|
||||
|
||||
scope :automation_ready, -> {
|
||||
where.not(group_number: [nil, ''])
|
||||
}
|
||||
|
||||
scope :in_automation_initilization, -> {
|
||||
left_outer_joins(:id_card_setup)
|
||||
.where(initialized: false)
|
||||
.or(
|
||||
where(id_card_setup: {initialized: false})
|
||||
).distinct
|
||||
}
|
||||
|
||||
scope :missing_keychain_initialization, -> {
|
||||
uninitialized.automation_ready
|
||||
}
|
||||
|
||||
scope :uninitialized_id_card_setup, -> {
|
||||
left_outer_joins(:id_card_setup)
|
||||
.where(id_card_setup: {initialized: false})
|
||||
}
|
||||
|
||||
scope :missing_plans, -> {
|
||||
left_outer_joins(:plans)
|
||||
.where(id_card_plans: { pb_product_key: [nil, ""] })
|
||||
.distinct
|
||||
}
|
||||
|
||||
scope :has_plans, -> {
|
||||
left_outer_joins(:plans)
|
||||
.where("id_card_plans.pb_product_key IS NOT NULL AND id_card_plans.pb_product_key != ''")
|
||||
.distinct
|
||||
}
|
||||
|
||||
scope :missing_members, -> {
|
||||
left_outer_joins(:members)
|
||||
.where(members: { id: nil })
|
||||
.distinct
|
||||
}
|
||||
|
||||
scope :has_members, -> {
|
||||
left_outer_joins(:members)
|
||||
.where.not(members: { id: nil })
|
||||
.distinct
|
||||
}
|
||||
|
||||
scope :missing_plans_initialization, -> {
|
||||
initialized.uninitialized_id_card_setup.missing_plans
|
||||
}
|
||||
|
||||
scope :missing_members_initialization, -> {
|
||||
initialized.uninitialized_id_card_setup.has_plans.missing_members
|
||||
}
|
||||
|
||||
scope :ready_for_id_card_activation, -> {
|
||||
initialized.uninitialized_id_card_setup.has_members
|
||||
}
|
||||
|
||||
scope :with_active_id_card_setup, -> {
|
||||
active.left_outer_joins(:id_card_setup)
|
||||
.where(id_card_setup: {active: true})
|
||||
}
|
||||
|
||||
scope :deactivated, -> {
|
||||
inactive.initialized
|
||||
}
|
||||
end
|
||||
|
||||
def sync_members_with_vhcs
|
||||
AutomationService::EmployerMembersUpdate.new(pl_plan_key).call
|
||||
end
|
||||
|
||||
def sync_plans_with_vhcs
|
||||
AutomationService::EmployerPlansUpdate.new(pl_plan_key).call
|
||||
end
|
||||
|
||||
def automation_identifier
|
||||
attributes.with_indifferent_access.slice(
|
||||
pl_plan_key.present? ? :pl_plan_key : :group_number
|
||||
)
|
||||
end
|
||||
|
||||
def sync_with_vhcs
|
||||
employer_identifier = automation_identifier
|
||||
AutomationService::EmployerUpdate.new(employer_identifier).call
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
module MemberAutomation
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def sync_with_vhcs
|
||||
AutomationService::MemberUpdate.new(self.employer.pl_plan_key, self.pb_entity_key).call
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,126 @@
|
||||
class Employer < ApplicationRecord
|
||||
include EmployerAutomation
|
||||
belongs_to :broker, optional: true
|
||||
has_many :members, dependent: :destroy
|
||||
accepts_nested_attributes_for :members, allow_destroy: true, reject_if: :all_blank
|
||||
has_one :id_card_setup, class_name: 'IdCard::Setup', dependent: :destroy
|
||||
has_many :plans, class_name: 'IdCard::Plan', through: :id_card_setup
|
||||
has_many :print_data, class_name: 'IdCard::PrintData', dependent: :destroy
|
||||
|
||||
validates :name, :slug, :effective_date, presence: true
|
||||
validates :group_number, :pl_plan_key, :company_pb_entity_key, :plan_id, presence: true, if: -> { initialized }
|
||||
|
||||
validates :name, :slug, :group_number, :pl_plan_key, :company_pb_entity_key, :plan_id, uniqueness: true, allow_blank: true
|
||||
|
||||
scope :active, -> { where(active: true) }
|
||||
scope :inactive, -> { where(active: false) }
|
||||
|
||||
before_validation :create_slug, if: :will_save_change_to_name?
|
||||
before_validation :active_initialized_check, if: :will_save_change_to_active?
|
||||
|
||||
|
||||
def create_slug
|
||||
self.slug = Employer.employer_trim_name(name).parameterize
|
||||
end
|
||||
|
||||
def active_initialized_check
|
||||
if active
|
||||
self.initialized = true
|
||||
end
|
||||
if active == false
|
||||
id_card_setup&.update(active: false)
|
||||
end
|
||||
end
|
||||
|
||||
def id_card_enabled?
|
||||
self.id_card_setup.present?
|
||||
end
|
||||
|
||||
def claims_check_enabled?
|
||||
false
|
||||
end
|
||||
|
||||
def employer_member_keys
|
||||
{
|
||||
pl_plan_key: self.pl_plan_key,
|
||||
member_keys: self.members.pluck(:pb_entity_key)
|
||||
}
|
||||
end
|
||||
|
||||
def employer_member_keys_by_plan(pb_product_key)
|
||||
{
|
||||
pl_plan_key: self.pl_plan_key,
|
||||
member_keys: self.plans.find_by(pb_product_key: pb_product_key).members.pluck(:pb_entity_key)
|
||||
}
|
||||
end
|
||||
|
||||
def name_to_logo_filename(extension)
|
||||
Employer.employer_trim_name(self.name).titleize.gsub(/[^a-zA-Z]/, '').concat('Logo').concat(extension.downcase)
|
||||
end
|
||||
|
||||
def self.employer_trim_name(employer_name)
|
||||
# employer_name = name.present? ? name : self.name
|
||||
regex_source = Regexp.union(["health ", "plan", "the", "inc", "llc", "group"]).source
|
||||
case_insensitive_regex = Regexp.new(regex_source, "i")
|
||||
employer_name.gsub(case_insensitive_regex, "").gsub(/[^[:alpha:][:space:]]/, "").squish
|
||||
end
|
||||
|
||||
def self.permitted_params(params)
|
||||
params.require(:employer).permit(
|
||||
:name,
|
||||
:slug,
|
||||
:group_number,
|
||||
:pl_plan_key,
|
||||
:effective_date
|
||||
)
|
||||
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: DateTime.strptime(self.effective_date, "%m/%d/%y")
|
||||
)
|
||||
|
||||
rx_info = self.id_card_setup.rx_section
|
||||
Vhcs::HlrxCrosRef.create!(
|
||||
group_no: self.group_number,
|
||||
rx_group_id: self.group_number,
|
||||
help_desk: rx_info.help_desk,
|
||||
customer_service: rx_info.customer_service,
|
||||
web_url: rx_info.web_url,
|
||||
pl_plan_key: self.pl_plan_key
|
||||
)
|
||||
|
||||
self.id_card_setup.plans.each_with_index do |plan, i|
|
||||
plan.plan_benefits.each do |bene|
|
||||
Vhcs::HlEgglestonCardBenefit.create!(
|
||||
plan_id: plan.pb_product_key,
|
||||
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,14 @@
|
||||
module HebWeb
|
||||
class BrokerXRef < HebWebRecord
|
||||
|
||||
self.table_name = 'BrokerXRef'
|
||||
|
||||
alias_attribute :id, :Id
|
||||
alias_attribute :pl_plan_key, :PLPlanKey
|
||||
alias_attribute :pb_entity_key, :PBEntityKey
|
||||
alias_attribute :plan_name, :PlanName
|
||||
alias_attribute :employer_pl_plan_key, :EmployerPLPlanKey
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class HebWebRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
connects_to database: { writing: :heb_web, reading: :heb_web }
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
module IdCard
|
||||
def self.table_name_prefix
|
||||
"id_card_"
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,33 @@
|
||||
module IdCard
|
||||
class EmployerLogo < ApplicationRecord
|
||||
belongs_to :setup, optional: true
|
||||
validates :filename, :image_data, :content_type, :aspect_ratio, presence: true
|
||||
validates :filename, uniqueness: true
|
||||
|
||||
before_validation :process_image, if: :image_data_changed?
|
||||
|
||||
private
|
||||
|
||||
def process_image
|
||||
image = Vips::Image.new_from_buffer(self.image_data, "")
|
||||
|
||||
resized_image = ImageProcessing::Vips
|
||||
.source(image)
|
||||
.resize_to_limit(nil, 400)
|
||||
|
||||
processed_image = resized_image.convert("png").call
|
||||
new_image_data = processed_image.read
|
||||
if new_image_data
|
||||
self.image_data = new_image_data
|
||||
self.filename = File.basename(self.filename, File.extname(self.filename)) + ".png"
|
||||
self.content_type = "image/png"
|
||||
end
|
||||
|
||||
image_ratio = image.width.to_f / image.height
|
||||
if image_ratio
|
||||
self.aspect_ratio = image_ratio.round(2)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,53 @@
|
||||
module IdCard
|
||||
class FieldException < ApplicationRecord
|
||||
belongs_to :setup
|
||||
has_many :field_exception_items, dependent: :destroy
|
||||
accepts_nested_attributes_for :field_exception_items, allow_destroy: true, reject_if: :all_blank
|
||||
|
||||
serialize :exception_values, coder: JSON
|
||||
|
||||
validates :exception_type, :exception_values, presence: true
|
||||
|
||||
VALID_TYPES = ['family_id', 'zipcode', 'state'].freeze
|
||||
|
||||
before_validation :format_exception_values, if: :exception_values_changed?
|
||||
|
||||
validates :exception_type, inclusion: { in: VALID_TYPES,
|
||||
message: "%{value} is not a valid exception type" }
|
||||
|
||||
|
||||
def to_card_attrs
|
||||
self.field_exception_items.map(&:card_attrs).reduce({}, :merge)
|
||||
end
|
||||
|
||||
class << self
|
||||
|
||||
def permitted_params(params)
|
||||
params.require(:id_card_setup).permit(
|
||||
field_exceptions_attributes: [
|
||||
:exception_type,
|
||||
:exception_values,
|
||||
:_destroy,
|
||||
field_exception_items_attributes: [
|
||||
:field_name,
|
||||
:field_value,
|
||||
:network_logo_id,
|
||||
:provider_section_id,
|
||||
:_destroy
|
||||
]
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def format_exception_values
|
||||
if self.exception_values.is_a?(String)
|
||||
self.exception_values = self.exception_values.split(",").map(&:strip)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,45 @@
|
||||
module IdCard
|
||||
class FieldExceptionItem < ApplicationRecord
|
||||
belongs_to :field_exception
|
||||
belongs_to :network_logo, optional: true
|
||||
belongs_to :provider_section, optional: true
|
||||
|
||||
validate :only_one_exception_field_present
|
||||
validates :field_name, presence: true
|
||||
validates :field_name, uniqueness: { scope: :field_exception_id }
|
||||
|
||||
FIELDS_TO_VALIDATE = [:field_value, :network_logo_id, :provider_section_id].freeze
|
||||
|
||||
VALID_FIELD_NAMES = ['network_logo', 'provider_section', 'medical_eff_date']
|
||||
|
||||
validates :field_name, inclusion: { in: VALID_FIELD_NAMES,
|
||||
message: "%{value} is not a valid Id Card Field Name" }
|
||||
|
||||
|
||||
def card_attrs
|
||||
case self.field_name
|
||||
when "network_logo"
|
||||
{"network_logo_filename" => IdCard::NetworkLogo.find(self.network_logo_id).filename}
|
||||
when "provider_section"
|
||||
IdCard::ProviderSection.find(self.provider_section_id).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
|
||||
)
|
||||
when "medical_eff_date"
|
||||
{"medical_eff_date" => self.field_value}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def only_one_exception_field_present
|
||||
present_fields = FIELDS_TO_VALIDATE.count { |field| self[field].present? }
|
||||
|
||||
if present_fields != 1
|
||||
errors.add(:base, "Only one exception field can be present at a time")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,46 @@
|
||||
module IdCard
|
||||
class NetworkLogo < ApplicationRecord
|
||||
validates :filename, :image_data, :content_type, :aspect_ratio, presence: true
|
||||
validates :filename, uniqueness: true
|
||||
|
||||
before_validation :process_image, if: :image_data_changed?
|
||||
|
||||
scope :defaults, -> { where(default: true) }
|
||||
|
||||
class << self
|
||||
|
||||
def medcost
|
||||
defaults.where("filename LIKE ?", "%MedCost%")
|
||||
end
|
||||
|
||||
def cigna
|
||||
defaults.where("filename LIKE ?", "%Cigna%")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def process_image
|
||||
image = Vips::Image.new_from_buffer(self.image_data, "")
|
||||
|
||||
resized_image = ImageProcessing::Vips
|
||||
.source(image)
|
||||
.resize_to_limit(nil, 400)
|
||||
|
||||
processed_image = resized_image.convert("png").call
|
||||
new_image_data = processed_image.read
|
||||
if new_image_data
|
||||
self.image_data = new_image_data
|
||||
self.filename = File.basename(self.filename, File.extname(self.filename)) + ".png"
|
||||
self.content_type = "image/png"
|
||||
end
|
||||
|
||||
image_ratio = image.width.to_f / image.height
|
||||
if image_ratio
|
||||
self.aspect_ratio = image_ratio.round(2)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,87 @@
|
||||
module IdCard
|
||||
class Plan < ApplicationRecord
|
||||
belongs_to :setup, optional: true
|
||||
has_many :plan_benefits, dependent: :destroy
|
||||
accepts_nested_attributes_for :plan_benefits, allow_destroy: true, reject_if: :all_blank
|
||||
has_many :members, class_name: 'Member', foreign_key: :id_card_plan_id
|
||||
|
||||
validates :title, presence: true
|
||||
validates :pb_product_key, :pl_plan_key, presence: true, if: -> { setup&.active }
|
||||
validates :pb_product_key, uniqueness: true, allow_nil: true
|
||||
validate :validate_plan_benefits_count, unless: -> { template }
|
||||
|
||||
scope :templates, -> { where(template: true) }
|
||||
|
||||
FARIOS_BENEFIT_FIELDS = ["Primary Visit", "Specialist Visit", "Urgent Care", "INN-Ind Ded", "INN-Family Ded", "OON-Ind Ded", "OON-Family Ded", "Co-Insurance", "INN-Ind OOP", "INN-Family OOP", "OON-Ind OOP", "OON-Family OOP", "Emergency Room", "Preventive Care"].freeze
|
||||
TANDEMLOC_BENEFIT_FIELDS = ["Physician Visit", "Specialist Visit", "Urgent Care", "Deductible", "Co-Insurance", "Out-of-Pocket", "Emergency Room", "Preventive Care"].freeze
|
||||
SMART_BENEFIT_FIELDS = [].freeze
|
||||
|
||||
after_initialize :build_plan_benefits, if: :new_record?
|
||||
|
||||
def build_plan_benefits
|
||||
if plan_benefits.empty?
|
||||
plan_benefit_fields = case setup&.card_template
|
||||
when "TandemlocIDCard"
|
||||
TANDEMLOC_BENEFIT_FIELDS
|
||||
when "SmartIDCard"
|
||||
SMART_BENEFIT_FIELDS
|
||||
else
|
||||
FARIOS_BENEFIT_FIELDS
|
||||
end
|
||||
plan_benefit_fields.each_with_index do |bene, i|
|
||||
self.plan_benefits.build(benefit_desc: bene, sequence: (i + 1))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def format_template
|
||||
formatted_title = title
|
||||
if pl_plan_key.present?
|
||||
employer_name = Employer.find_by(pl_plan_key: pl_plan_key).pluck(:name)
|
||||
formatted_title.concat( " (#{employer_name})" )
|
||||
end
|
||||
{ id: id, title: formatted_title }
|
||||
end
|
||||
|
||||
class << self
|
||||
|
||||
def permitted_params(params)
|
||||
params.require(:id_card_setup).permit(
|
||||
plans_attributes: [
|
||||
:id,
|
||||
:title,
|
||||
:pb_product_key,
|
||||
:pl_plan_key,
|
||||
:_destroy,
|
||||
plan_benefits_attributes: [
|
||||
:id,
|
||||
:benefit_desc,
|
||||
:benefit,
|
||||
:sequence,
|
||||
:_destroy,
|
||||
]
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_plan_benefits_count
|
||||
plan_benefits_size = plan_benefits.size
|
||||
template_benefits_size = case setup&.card_template
|
||||
when "TandemlocIDCard"
|
||||
TANDEMLOC_BENEFIT_FIELDS.size
|
||||
when "SmartIDCard"
|
||||
SMART_BENEFIT_FIELDS.size
|
||||
else
|
||||
FARIOS_BENEFIT_FIELDS.size
|
||||
end
|
||||
unless plan_benefits_size == template_benefits_size
|
||||
errors.add(:base, "Plan Benefits size (#{plan_benefits_size}) does not match ID Card Template (#{template_benefits_size})")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,8 @@
|
||||
module IdCard
|
||||
class PlanBenefit < ApplicationRecord
|
||||
belongs_to :plan
|
||||
|
||||
validates :benefit_desc, :sequence, presence: true
|
||||
validates :benefit, presence: true, unless: :new_record?
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,26 @@
|
||||
module IdCard
|
||||
class PrintData < ApplicationRecord
|
||||
belongs_to :employer, class_name: 'Employer'
|
||||
|
||||
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 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 dependent_1 dependent_2 dependent_3 dependent_4 dependent_5 dependent_6 dependent_7 dependent_8 dental_coverage]
|
||||
|
||||
before_validation :assign_blank_strings_to_unassigned_params
|
||||
|
||||
private
|
||||
|
||||
def has_jasper_sorting_fields
|
||||
missing_sample_card_fields = sample_plan_title.blank?
|
||||
missing_member_card_fields = employer_name.blank? || full_name_last_name_first.blank?
|
||||
|
||||
if missing_sample_card_fields || missing_member_card_fields
|
||||
errors.add(:base, "Required field for Jasper Server is missing")
|
||||
end
|
||||
end
|
||||
|
||||
def assign_blank_strings_to_unassigned_params
|
||||
STRING_ATTRIBUTES.each do |attr|
|
||||
self[attr] = "" if self[attr].blank?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,45 @@
|
||||
module IdCard
|
||||
class ProviderSection < ApplicationRecord
|
||||
|
||||
scope :defaults, -> { where(default: true) }
|
||||
|
||||
def self.permitted_params(params)
|
||||
params.require(:id_card_setup).require(:provider_section).permit(
|
||||
:title,
|
||||
: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
|
||||
)
|
||||
end
|
||||
|
||||
def display_title
|
||||
if self.default
|
||||
"Default #{self.title}"
|
||||
else
|
||||
self.title
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
module IdCard
|
||||
class RxSection < ApplicationRecord
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,120 @@
|
||||
module IdCard
|
||||
class Setup < ApplicationRecord
|
||||
belongs_to :employer, class_name: 'Employer'
|
||||
belongs_to :network_logo, optional: true
|
||||
belongs_to :provider_section, optional: true
|
||||
belongs_to :rx_section, optional: true
|
||||
has_one :employer_logo, dependent: :destroy
|
||||
|
||||
has_many :plans, dependent: :destroy
|
||||
has_many :field_exceptions, dependent: :destroy
|
||||
|
||||
validates :print_name, :network_provider, :card_template, :employer_logo, :network_logo_id,
|
||||
:provider_section_id, :rx_section_id, presence: true, unless: :new_record?
|
||||
validates :pl_plan_key, :rx_group_number, presence: true, if: -> { initialized }
|
||||
validate :validate_print_name_fits_on_card
|
||||
|
||||
attr_accessor :print_name_pixel_width
|
||||
|
||||
accepts_nested_attributes_for :plans, allow_destroy: true, reject_if: :all_blank
|
||||
accepts_nested_attributes_for :field_exceptions, allow_destroy: true, reject_if: :all_blank
|
||||
|
||||
attribute :queued_card_count, :integer, default: 0
|
||||
|
||||
scope :active, -> { where(active: true) }
|
||||
|
||||
FORM_COLORS = ['atmosphere', 'verdigris-vivid', 'cobalt-vivid', 'bluemana']
|
||||
MODULE_COLOR = 'atmosphere'
|
||||
|
||||
before_save :active_initialized_check, if: :will_save_change_to_active?
|
||||
|
||||
def active_initialized_check
|
||||
if active
|
||||
self.initialized = true
|
||||
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
|
||||
|
||||
def has_field_exceptions?
|
||||
field_exceptions.present?
|
||||
end
|
||||
|
||||
def sample_card_print_ready?
|
||||
print_name.present? &&
|
||||
card_template.present? &&
|
||||
employer_logo.present? &&
|
||||
network_logo_id.present? &&
|
||||
provider_section_id.present? &&
|
||||
rx_section_id.present? &&
|
||||
plans.present?
|
||||
end
|
||||
|
||||
def member_cards_print_ready?
|
||||
sample_card_print_ready? &&
|
||||
plans.present? &&
|
||||
plans.all? { |plan| plan.pb_product_key.present? } &&
|
||||
employer.members.present?
|
||||
end
|
||||
|
||||
def activation_ready?
|
||||
member_cards_print_ready? && !active
|
||||
end
|
||||
|
||||
def field_exceptions_card_attributes_by_member_id(member_array = nil)
|
||||
unless member_array.present?
|
||||
member_array = self.employer.members.pluck(:pb_entity_key)
|
||||
end
|
||||
|
||||
card_fes = self.field_exceptions.includes(:field_exception_items).in_order_of(:exception_type, IdCard::FieldException::VALID_TYPES)
|
||||
card_exceptions_map = {}
|
||||
card_fes.each do |fe|
|
||||
if fe.exception_type == "family_id"
|
||||
matches = Member.where(pb_entity_key: member_array, family_id: fe.exception_values).pluck(:pb_entity_key)
|
||||
elsif fe.exception_type == "zipcode"
|
||||
matches = Vhcs::PbEntityAddress.where(pb_entity_key: member_array, zip: fe.exception_values).pluck(:pb_entity_key)
|
||||
elsif fe.exception_type == "state"
|
||||
matches = Vhcs::PbEntityAddress.where(pb_entity_key: member_array, state: fe.exception_values).pluck(:pb_entity_key)
|
||||
end
|
||||
if matches.present?
|
||||
card_exceptions_map[fe.id] = fe.to_card_attrs
|
||||
matches.each do |match|
|
||||
unless card_exceptions_map[match].present?
|
||||
card_exceptions_map[match] = fe.id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
card_exceptions_map
|
||||
end
|
||||
|
||||
def self.permitted_params(params)
|
||||
params.require(:id_card_setup).permit(
|
||||
:print_name,
|
||||
:print_name_pixel_width,
|
||||
:network_provider,
|
||||
:card_template,
|
||||
:rx_group_number,
|
||||
:network_logo_id,
|
||||
:rx_section_id,
|
||||
:provider_section_id
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_print_name_fits_on_card
|
||||
if print_name_pixel_width.to_i > 100
|
||||
errors.add(:print_name, "Too Long For Card")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,35 @@
|
||||
class Member < ApplicationRecord
|
||||
include MemberAutomation
|
||||
belongs_to :id_card_plan, class_name: 'IdCard::Plan', optional: true
|
||||
belongs_to :employer
|
||||
|
||||
serialize :dependents, coder: JSON
|
||||
|
||||
validates :pb_entity_key, presence: true
|
||||
validates :name, :family_id, :mb_member_key, :pl_plan_key,
|
||||
:id_card_display_name, presence: true, unless: :new_record?
|
||||
validates :division, presence: true, if: -> { employer.id_card_setup.has_divisions }
|
||||
# validates :coverage_class, :dental_plan_key, presence: true, if: -> { employer.id_card_setup.has_dental }
|
||||
validates :mb_member_key, :pb_entity_key, uniqueness: true
|
||||
validates :name, uniqueness: { scope: :employer_id }
|
||||
|
||||
before_validation :format_dependents, if: :dependents_changed?
|
||||
|
||||
def id_card_field_exception_values
|
||||
address = Vhcs::PbEntityAddress.find_by(pb_entity_key: self.pb_entity_key)
|
||||
{
|
||||
zipcode: address.zip,
|
||||
state: address.state,
|
||||
family_id: self.family_id
|
||||
}
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def format_dependents
|
||||
if self.dependents.is_a?(String)
|
||||
self.dependents = self.dependents.split(",").map(&:strip)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
class Provider < ApplicationRecord
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
class ProviderGroup < ApplicationRecord
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
module Report
|
||||
def self.table_name_prefix
|
||||
"report_"
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class Report::ComparisonError < ApplicationRecord
|
||||
belongs_to :employer_card_comparison, optional: true
|
||||
belongs_to :member_card_comparison, optional: true
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
module Report
|
||||
class EmployerCardComparison < ApplicationRecord
|
||||
has_many :comparison_errors, dependent: :destroy
|
||||
accepts_nested_attributes_for :comparison_errors, allow_destroy: true, reject_if: :all_blank
|
||||
|
||||
has_many :member_card_comparisons
|
||||
has_many :member_comparison_errors, through: :member_card_comparisons, source: :comparison_errors
|
||||
|
||||
|
||||
def employer_total_errors
|
||||
self.comparison_errors.count + self.member_comparison_errors.count
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
module Report
|
||||
class MemberCardComparison < ApplicationRecord
|
||||
has_many :comparison_errors, dependent: :destroy
|
||||
accepts_nested_attributes_for :comparison_errors, allow_destroy: true, reject_if: :all_blank
|
||||
|
||||
belongs_to :employer_card_comparison, optional: true
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
class Report::OldCardDuplicate < ApplicationRecord
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class User < ApplicationRecord
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||
devise :database_authenticatable, :registerable,
|
||||
:recoverable, :rememberable, :validatable,
|
||||
:lockable, :trackable
|
||||
|
||||
enum role: { user: 0, admin: 1, dev: 2 }
|
||||
end
|
||||
@@ -0,0 +1,43 @@
|
||||
module Vhcs
|
||||
class GenLookupTables < VhcsRecord
|
||||
|
||||
self.table_name = 'GEN_LookupTables'
|
||||
|
||||
alias_attribute :record_id, :RecordID
|
||||
alias_attribute :table_id, :TableID
|
||||
alias_attribute :value_id, :ValueID
|
||||
alias_attribute :company_pb_entity_key, :CompanyPBEntityKey
|
||||
alias_attribute :short_desc, :ShortDesc
|
||||
alias_attribute :long_desc, :LongDesc
|
||||
alias_attribute :is_active, :IsActive
|
||||
alias_attribute :is_default, :IsDefault
|
||||
alias_attribute :is_bit_flag, :IsBitFlag
|
||||
alias_attribute :is_company_specific, :IsCompanySpecific
|
||||
alias_attribute :is_editable, :IsEditable
|
||||
alias_attribute :long_description, :LongDescription
|
||||
alias_attribute :sort_value, :SortValue
|
||||
alias_attribute :system_id_bit_mask, :SystemIDBitMask
|
||||
|
||||
def attributes
|
||||
rails_like = {
|
||||
record_id: self.record_id,
|
||||
table_id: self.table_id,
|
||||
value_id: self.value_id,
|
||||
company_pb_entity_key: self.company_pb_entity_key,
|
||||
short_desc: self.short_desc,
|
||||
long_desc: self.long_desc,
|
||||
is_active: self.is_active,
|
||||
is_default: self.is_default,
|
||||
is_bit_flag: self.is_bit_flag,
|
||||
is_company_specific: self.is_company_specific,
|
||||
is_editable: self.is_editable,
|
||||
long_description: self.long_description,
|
||||
sort_value: self.sort_value,
|
||||
system_id_bit_mask: self.system_id_bit_mask,
|
||||
}
|
||||
super.merge(rails_like)
|
||||
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,218 @@
|
||||
module Vhcs
|
||||
class HlidCardEggData < VhcsRecord
|
||||
|
||||
self.table_name = 'HLIDCardEggData'
|
||||
|
||||
alias_attribute :id, :ID
|
||||
alias_attribute :facility, :Facility
|
||||
alias_attribute :employer_name, :Division
|
||||
alias_attribute :full_name, :FullName
|
||||
alias_attribute :ssn, :SSN
|
||||
alias_attribute :medical_coverage, :MedicalCoverage
|
||||
alias_attribute :medical_eff_date, :MedicalEffDate
|
||||
alias_attribute :group_number, :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 :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 :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 :mail_to, :MailTo
|
||||
alias_attribute :mail_to_2, :MailTo2
|
||||
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 :contact_line_1, :ContactLine1
|
||||
alias_attribute :contact_line_2, :ContactLine2
|
||||
alias_attribute :contact_line_3, :ContactLine3
|
||||
alias_attribute :group_number, :GroupNumber
|
||||
alias_attribute :family_id, :FamilyId
|
||||
alias_attribute :group_no, :GroupNo
|
||||
alias_attribute :rx_group, :RXGroupID
|
||||
alias_attribute :help_desk, :HelpDesk
|
||||
alias_attribute :customer_service, :CustomerService
|
||||
alias_attribute :web_url, :WebUrl
|
||||
alias_attribute :expr_1, :Expr1
|
||||
alias_attribute :line_3, :Line3
|
||||
alias_attribute :dependent_1, :Dependent1
|
||||
alias_attribute :dependent_2, :Dependent2
|
||||
alias_attribute :dependent_3, :Dependent3
|
||||
alias_attribute :dependent_4, :Dependent4
|
||||
alias_attribute :dependent_5, :Dependent5
|
||||
alias_attribute :dependent_6, :Dependent6
|
||||
alias_attribute :dependent_7, :Dependent7
|
||||
alias_attribute :dependent_8, :Dependent8
|
||||
alias_attribute :benefit_desc_1, :BenDesc1
|
||||
alias_attribute :benefit_1, :Ben1
|
||||
alias_attribute :benefit_desc_2, :BenDesc2
|
||||
alias_attribute :benefit_2, :Ben2
|
||||
alias_attribute :benefit_desc_3, :BenDesc3
|
||||
alias_attribute :benefit_3, :Ben3
|
||||
alias_attribute :benefit_desc_4, :BenDesc4
|
||||
alias_attribute :benefit_4, :Ben4
|
||||
alias_attribute :benefit_desc_5, :BenDesc5
|
||||
alias_attribute :benefit_5, :Ben5
|
||||
alias_attribute :benefit_desc_6, :BenDesc6
|
||||
alias_attribute :benefit_6, :Ben6
|
||||
alias_attribute :benefit_desc_7, :BenDesc7
|
||||
alias_attribute :benefit_7, :Ben7
|
||||
alias_attribute :benefit_desc_8, :BenDesc8
|
||||
alias_attribute :benefit_8, :Ben8
|
||||
alias_attribute :benefit_desc_9, :BenDesc9
|
||||
alias_attribute :benefit_9, :Ben9
|
||||
alias_attribute :benefit_desc_10, :BenDesc10
|
||||
alias_attribute :benefit_10, :Ben10
|
||||
alias_attribute :benefit_desc_11, :BenDesc11
|
||||
alias_attribute :benefit_11, :Ben11
|
||||
alias_attribute :benefit_desc_12, :BenDesc12
|
||||
alias_attribute :benefit_12, :Ben12
|
||||
alias_attribute :benefit_desc_13, :BenDesc13
|
||||
alias_attribute :benefit_13, :Ben13
|
||||
alias_attribute :benefit_desc_14, :BenDesc14
|
||||
alias_attribute :benefit_14, :Ben14
|
||||
alias_attribute :pl_plan_key, :PLPlanKey
|
||||
alias_attribute :primary_mb_member_key, :PrimaryMBMemberKey
|
||||
alias_attribute :ppo_lookup_1, :PPOLookup1
|
||||
alias_attribute :ppo_lookup_2, :PPOLookup2
|
||||
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 :misc_data, :MiscData
|
||||
alias_attribute :ppo_data, :PPOData
|
||||
alias_attribute :ppo_data_2, :PPOData2
|
||||
alias_attribute :ppo_data_3, :PPOData3
|
||||
alias_attribute :last_name, :LastName
|
||||
alias_attribute :provider_line_12, :ProviderLine12
|
||||
alias_attribute :claim_to_12, :ClaimTo12
|
||||
|
||||
def attributes
|
||||
rails_like = {
|
||||
id: self.id,
|
||||
facility: self.facility,
|
||||
employer_name: self.employer_name,
|
||||
full_name: self.full_name,
|
||||
ssn: self.ssn,
|
||||
medical_coverage: self.medical_coverage,
|
||||
medical_eff_date: self.medical_eff_date,
|
||||
group_number: self.group_number,
|
||||
dental_coverage: self.dental_coverage,
|
||||
dental_eff_date: self.dental_eff_date,
|
||||
dental_group_num: self.dental_group_num,
|
||||
card_type: self.card_type,
|
||||
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,
|
||||
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,
|
||||
mail_to: self.mail_to,
|
||||
mail_to_2: self.mail_to_2,
|
||||
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,
|
||||
contact_line_1: self.contact_line_1,
|
||||
contact_line_2: self.contact_line_2,
|
||||
contact_line_3: self.contact_line_3,
|
||||
family_id: self.family_id,
|
||||
group_no: self.group_no,
|
||||
rx_group: self.rx_group,
|
||||
help_desk: self.help_desk,
|
||||
customer_service: self.customer_service,
|
||||
web_url: self.web_url,
|
||||
expr_1: self.expr_1,
|
||||
line_3: self.line_3,
|
||||
dependent_1: self.dependent_1,
|
||||
dependent_2: self.dependent_2,
|
||||
dependent_3: self.dependent_3,
|
||||
dependent_4: self.dependent_4,
|
||||
dependent_5: self.dependent_5,
|
||||
dependent_6: self.dependent_6,
|
||||
dependent_7: self.dependent_7,
|
||||
dependent_8: self.dependent_8,
|
||||
benefit_desc_1: self.benefit_desc_1,
|
||||
benefit_1: self.benefit_1,
|
||||
benefit_desc_2: self.benefit_desc_2,
|
||||
benefit_2: self.benefit_2,
|
||||
benefit_desc_3: self.benefit_desc_3,
|
||||
benefit_3: self.benefit_3,
|
||||
benefit_desc_4: self.benefit_desc_4,
|
||||
benefit_4: self.benefit_4,
|
||||
benefit_desc_5: self.benefit_desc_5,
|
||||
benefit_5: self.benefit_5,
|
||||
benefit_desc_6: self.benefit_desc_6,
|
||||
benefit_6: self.benefit_6,
|
||||
benefit_desc_7: self.benefit_desc_7,
|
||||
benefit_7: self.benefit_7,
|
||||
benefit_desc_8: self.benefit_desc_8,
|
||||
benefit_8: self.benefit_8,
|
||||
benefit_desc_9: self.benefit_desc_9,
|
||||
benefit_9: self.benefit_9,
|
||||
benefit_desc_10: self.benefit_desc_10,
|
||||
benefit_10: self.benefit_10,
|
||||
benefit_desc_11: self.benefit_desc_11,
|
||||
benefit_11: self.benefit_11,
|
||||
benefit_desc_12: self.benefit_desc_12,
|
||||
benefit_12: self.benefit_12,
|
||||
benefit_desc_13: self.benefit_desc_13,
|
||||
benefit_13: self.benefit_13,
|
||||
benefit_desc_14: self.benefit_desc_14,
|
||||
benefit_14: self.benefit_14,
|
||||
pl_plan_key: self.pl_plan_key,
|
||||
primary_mb_member_key: self.primary_mb_member_key,
|
||||
ppo_lookup_1: self.ppo_lookup_1,
|
||||
ppo_lookup_2: self.ppo_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,
|
||||
misc_data: self.misc_data,
|
||||
ppo_data: self.ppo_data,
|
||||
ppo_data_2: self.ppo_data_2,
|
||||
ppo_data_3: self.ppo_data_3,
|
||||
last_name: self.last_name,
|
||||
provider_line_12: self.provider_line_12,
|
||||
claim_to_12: self.claim_to_12,
|
||||
}
|
||||
super.merge(rails_like)
|
||||
end
|
||||
|
||||
|
||||
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,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,217 @@
|
||||
module Vhcs
|
||||
class HlidCardsViewEgg < VhcsRecord
|
||||
|
||||
self.table_name = 'HLIDCardsViewEgg'
|
||||
|
||||
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 :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 :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_1_0, :ProviderLine10
|
||||
alias_attribute :provider_line_1_1, :ProviderLine11
|
||||
alias_attribute :mail_to, :MailTo
|
||||
alias_attribute :mail_to_2, :MailTo2
|
||||
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_1_0, :ClaimTo10
|
||||
alias_attribute :claim_to_1_1, :ClaimTo11
|
||||
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 :family_id, :FamilyId
|
||||
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 :expr_1, :Expr1
|
||||
alias_attribute :line_3, :Line3
|
||||
alias_attribute :dependent_1, :Dependent1
|
||||
alias_attribute :dependent_2, :Dependent2
|
||||
alias_attribute :dependent_3, :Dependent3
|
||||
alias_attribute :dependent_4, :Dependent4
|
||||
alias_attribute :dependent_5, :Dependent5
|
||||
alias_attribute :dependent_6, :Dependent6
|
||||
alias_attribute :dependent_7, :Dependent7
|
||||
alias_attribute :dependent_8, :Dependent8
|
||||
alias_attribute :ben_desc_1, :BenDesc1
|
||||
alias_attribute :ben_1, :Ben1
|
||||
alias_attribute :ben_desc_2, :BenDesc2
|
||||
alias_attribute :ben_2, :Ben2
|
||||
alias_attribute :ben_desc_3, :BenDesc3
|
||||
alias_attribute :ben_3, :Ben3
|
||||
alias_attribute :ben_desc_4, :BenDesc4
|
||||
alias_attribute :ben_4, :Ben4
|
||||
alias_attribute :ben_desc_5, :BenDesc5
|
||||
alias_attribute :ben_5, :Ben5
|
||||
alias_attribute :ben_desc_6, :BenDesc6
|
||||
alias_attribute :ben_6, :Ben6
|
||||
alias_attribute :ben_desc_7, :BenDesc7
|
||||
alias_attribute :ben_7, :Ben7
|
||||
alias_attribute :ben_desc_8, :BenDesc8
|
||||
alias_attribute :ben_8, :Ben8
|
||||
alias_attribute :ben_desc_9, :BenDesc9
|
||||
alias_attribute :ben_9, :Ben9
|
||||
alias_attribute :ben_desc_1_0, :BenDesc10
|
||||
alias_attribute :ben_1_0, :Ben10
|
||||
alias_attribute :ben_desc_1_1, :BenDesc11
|
||||
alias_attribute :ben_1_1, :Ben11
|
||||
alias_attribute :ben_desc_1_2, :BenDesc12
|
||||
alias_attribute :ben_1_2, :Ben12
|
||||
alias_attribute :ben_desc_1_3, :BenDesc13
|
||||
alias_attribute :ben_1_3, :Ben13
|
||||
alias_attribute :ben_desc_1_4, :BenDesc14
|
||||
alias_attribute :ben_1_4, :Ben14
|
||||
alias_attribute :pl_plan_key, :PLPlanKey
|
||||
alias_attribute :mb_member_key, :MBMemberKey
|
||||
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 :miscdata, :MISCDATA
|
||||
alias_attribute :ppodata, :PPODATA
|
||||
alias_attribute :ppodata_2, :PPODATA2
|
||||
alias_attribute :ppodata_3, :PPODATA3
|
||||
alias_attribute :last_name, :LastName
|
||||
alias_attribute :provider_line_1_2, :ProviderLine12
|
||||
alias_attribute :claim_to_1_2, :ClaimTo12
|
||||
|
||||
def attributes
|
||||
rails_like = {
|
||||
facility: self.facility,
|
||||
division: self.division,
|
||||
full_name: self.full_name,
|
||||
ssn: self.ssn,
|
||||
medical_coverage: self.medical_coverage,
|
||||
medical_eff_date: self.medical_eff_date,
|
||||
medical_group_num: self.medical_group_num,
|
||||
dental_coverage: self.dental_coverage,
|
||||
dental_eff_date: self.dental_eff_date,
|
||||
dental_group_num: self.dental_group_num,
|
||||
card_type: self.card_type,
|
||||
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,
|
||||
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_1_0: self.provider_line_1_0,
|
||||
provider_line_1_1: self.provider_line_1_1,
|
||||
mail_to: self.mail_to,
|
||||
mail_to_2: self.mail_to_2,
|
||||
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_1_0: self.claim_to_1_0,
|
||||
claim_to_1_1: self.claim_to_1_1,
|
||||
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,
|
||||
family_id: self.family_id,
|
||||
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,
|
||||
expr_1: self.expr_1,
|
||||
line_3: self.line_3,
|
||||
dependent_1: self.dependent_1,
|
||||
dependent_2: self.dependent_2,
|
||||
dependent_3: self.dependent_3,
|
||||
dependent_4: self.dependent_4,
|
||||
dependent_5: self.dependent_5,
|
||||
dependent_6: self.dependent_6,
|
||||
dependent_7: self.dependent_7,
|
||||
dependent_8: self.dependent_8,
|
||||
ben_desc_1: self.ben_desc_1,
|
||||
ben_1: self.ben_1,
|
||||
ben_desc_2: self.ben_desc_2,
|
||||
ben_2: self.ben_2,
|
||||
ben_desc_3: self.ben_desc_3,
|
||||
ben_3: self.ben_3,
|
||||
ben_desc_4: self.ben_desc_4,
|
||||
ben_4: self.ben_4,
|
||||
ben_desc_5: self.ben_desc_5,
|
||||
ben_5: self.ben_5,
|
||||
ben_desc_6: self.ben_desc_6,
|
||||
ben_6: self.ben_6,
|
||||
ben_desc_7: self.ben_desc_7,
|
||||
ben_7: self.ben_7,
|
||||
ben_desc_8: self.ben_desc_8,
|
||||
ben_8: self.ben_8,
|
||||
ben_desc_9: self.ben_desc_9,
|
||||
ben_9: self.ben_9,
|
||||
ben_desc_1_0: self.ben_desc_1_0,
|
||||
ben_1_0: self.ben_1_0,
|
||||
ben_desc_1_1: self.ben_desc_1_1,
|
||||
ben_1_1: self.ben_1_1,
|
||||
ben_desc_1_2: self.ben_desc_1_2,
|
||||
ben_1_2: self.ben_1_2,
|
||||
ben_desc_1_3: self.ben_desc_1_3,
|
||||
ben_1_3: self.ben_1_3,
|
||||
ben_desc_1_4: self.ben_desc_1_4,
|
||||
ben_1_4: self.ben_1_4,
|
||||
pl_plan_key: self.pl_plan_key,
|
||||
mb_member_key: self.mb_member_key,
|
||||
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,
|
||||
miscdata: self.miscdata,
|
||||
ppodata: self.ppodata,
|
||||
ppodata_2: self.ppodata_2,
|
||||
ppodata_3: self.ppodata_3,
|
||||
last_name: self.last_name,
|
||||
provider_line_1_2: self.provider_line_1_2,
|
||||
claim_to_1_2: self.claim_to_1_2,
|
||||
}
|
||||
super.merge(rails_like)
|
||||
end
|
||||
|
||||
|
||||
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
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user