diff --git a/.ruby-version b/.ruby-version index 45674f16a8..aedc15bb0c 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.3 \ No newline at end of file +2.5.3 diff --git a/Gemfile b/Gemfile index 6994e96352..92ebdea230 100644 --- a/Gemfile +++ b/Gemfile @@ -1,90 +1,100 @@ source 'https://rubygems.org' +git_source(:github) { |repo| "https://github.com/#{repo}.git" } -gem 'rails', '4.2.2' +ruby '2.5.3' +# gem 'rails', '4.2.2' +gem 'rails', '~> 5.2', '<= 5.2.4.4' gem 'pg', '~> 0.18.4' +gem 'puma', '~> 3.11' gem 'jquery-rails' gem 'jquery-ui-rails' -gem 'sass-rails', '~> 5.0' -gem 'uglifier', '>= 1.3.0' -gem 'coffee-rails', '~> 4.1.0' -gem 'jbuilder', '~> 2.0' -gem 'simple_form', '~> 3.2' -gem 'bootstrap-sass', '~> 3.3.5' -gem 'devise', '~> 3.5', '>= 3.5.2' -gem 'haml-rails', '~> 0.9' -gem 'dotenv-rails', '~> 2.0.2' -gem 'roo', '~> 2.2' -gem 'fog' +gem 'sass-rails', '~> 6.0' +gem 'uglifier', '~> 4.2' +gem 'coffee-rails', '~> 5.0' +gem 'bootsnap', '>= 1.1.0', require: false +gem 'mini_racer', platforms: :ruby +gem 'jbuilder', '~> 2.10', '>= 2.10.1' +gem 'simple_form', '~> 5.0', '>= 5.0.3' +gem 'bootstrap-sass', '~> 3.4', '>= 3.4.1' +gem 'devise', '~> 4.7', '>= 4.7.3' +gem 'haml-rails', '~> 2.0', '>= 2.0.1' +gem 'dotenv-rails', '~> 2.7', '>= 2.7.6' +gem 'roo', '~> 2.8', '>= 2.8.3' +gem 'fog-aws', '~> 3.3' gem 's3' -gem 'ffaker', '~> 2.1.0' -gem 'draper', '~> 2.1' -gem 'datagrid', '~> 1.4.2' +gem 'ffaker', '~> 2.17' +gem 'draper', '~> 4.0', '>= 4.0.1' +gem 'datagrid', '~> 1.6', '>= 1.6.1' gem 'active_model_serializers' gem 'sinatra', require: false gem 'rack-cors', require: 'rack/cors' gem 'rails-erd' -gem 'phony_rails', '~> 0.12.11' +gem 'phony_rails', '~> 0.14.13' gem 'typhoeus' -gem 'foreman', '~> 0.78.0' -gem 'cancancan', '~> 1.13', '>= 1.13.1' -gem 'pundit', '~> 1.1' -gem 'tinymce-rails', '~> 4.5.6' -gem 'bootstrap-datepicker-rails', '~> 1.5' +gem 'foreman', '~> 0.87.2' +gem 'cancancan', '~> 3.1' +gem 'pundit', '~> 2.1' +gem 'tinymce-rails', '~> 5.6', '>= 5.6.2.1' +gem 'bootstrap-datepicker-rails', '~> 1.9', '>= 1.9.0.1' gem 'x-editable-rails', '~> 1.5', '>= 1.5.5.1' -gem 'select2-rails', '~> 3.5.9.3' -gem 'doorkeeper', '~> 4.4', '>= 4.4.3' -gem 'devise_token_auth', '~> 0.1.37' -gem 'omniauth', '~> 1.3', '>= 1.3.1' +gem 'select2-rails', '~> 4.0', '>= 4.0.13' +gem 'doorkeeper', '~> 5.4' +gem 'devise_token_auth' +gem 'omniauth', '~> 1.9', '>= 1.9.1' gem 'jquery-validation-rails' -gem 'google-api-client', '~> 0.10', require: 'google/apis/calendar_v3' -gem 'fullcalendar-rails', '~> 3.2.0.0' -gem 'momentjs-rails', '~> 2.17.1' +gem 'google-api-client', '~> 0.23.9', require: 'google/apis/calendar_v3' +gem 'fullcalendar-rails', '~> 3.9' +gem 'momentjs-rails', '~> 2.20', '>= 2.20.1' gem 'kaminari' gem 'jquery-datatables-rails', '~> 3.4' -gem 'friendly_id', '~> 5.1.0' -gem 'wicked_pdf', '~> 1.0', '>= 1.0.6' -gem 'wkhtmltopdf-binary-edge', '~> 0.12.3.0' -gem 'browser', '~> 2.1' -gem 'whenever', '~> 0.9.4' -gem 'thredded', '~> 0.6.1' -gem 'cocoon', '~> 1.2', '>= 1.2.9' -gem 'paper_trail', '~> 5.2' -gem 'carrierwave', '~> 1.1.0' -gem 'mini_magick', '~> 4.5' -gem 'chartkick', '~> 3.4' -gem 'font-awesome-rails', '~> 4.7' -gem 'spreadsheet', '~> 1.1.3' -gem 'apartment', '~> 1.2' -gem 'dropzonejs-rails', '~> 0.7.3' -gem 'bourbon', '~> 4.2' -gem 'neat', '~> 1.8' -gem 'sidekiq', '~> 4.1.0' -gem 'mongoid', '~> 5.2', '>= 5.2.1' -gem 'where-or', '~> 0.1.6' -gem 'dotiw', '~> 4.0.1' +gem 'friendly_id', '~> 5.4', '>= 5.4.1' +gem 'wicked_pdf', '~> 2.1' +gem 'wkhtmltopdf-binary-edge', '~> 0.12.6.0' +gem 'browser', '~> 5.1' +gem 'whenever', '~> 1.0' +gem 'thredded', '~> 0.16.4' +gem 'cocoon', '~> 1.2', '>= 1.2.15' +gem 'paper_trail', '~> 10.0', '>= 10.0.1' +gem 'paper_trail-association_tracking', '~> 2.1', '>= 2.1.1' +gem 'carrierwave', '~> 2.1' +gem 'mini_magick', '~> 4.11' +gem 'chartkick', '~> 3.4', '>= 3.4.2' +gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.5' +gem 'spreadsheet', '~> 1.2', '>= 1.2.6' +gem 'apartment', '~> 2.2', '>= 2.2.1' +gem 'dropzonejs-rails', '~> 0.8.5' +gem 'bourbon', '~> 7.0' +gem 'neat', '~> 1.7', '>= 1.7.4' +gem 'sidekiq', '~> 5.2', '>= 5.2.9' +gem 'mongoid', '~> 6.1', '>= 6.1.1' +gem 'dotiw', '~> 5.2' gem 'text', '~> 1.3', '>= 1.3.1' -gem 'acts_as_paranoid', '~> 0.6.1' -gem 'ancestry', '~> 3.0', '>= 3.0.5' +gem 'acts_as_paranoid', '~> 0.7.0' +gem 'ancestry', '~> 3.2', '>= 3.2.1' gem 'sysrandom', '~> 1.0', '>= 1.0.5' -gem 'write_xlsx', '~> 0.85.7' -gem 'caxlsx', '~> 2.0', '>= 2.0.2' -gem 'react-rails', '~> 2.6.0' -gem 'webpacker', '~> 4.0.7' +gem 'write_xlsx', '~> 0.86.0' +gem 'caxlsx', '~> 3.0', '>= 3.0.3' +gem 'react-rails', '~> 2.6', '>= 2.6.1' +gem 'webpacker', '~> 5.2', '>= 5.2.1' gem 'jquery_query_builder-rails', '~> 0.5.0' -gem 'globalize', '~> 5.1.0' -gem 'enumerize', '~> 2.3.1' +gem 'globalize', '~> 5.3' +gem 'enumerize', '~> 2.3', '>= 2.3.1' gem 'ulid', '~> 1.2' +gem 'dalli', '~> 2.7', '>= 2.7.11' +gem 'actionpack-page_caching', '~> 1.2', '>= 1.2.3' +gem 'actionpack-action_caching', '~> 1.2', '>= 1.2.1' group :development, :test do + gem 'byebug', platforms: %i[mri mingw x64_mingw] gem 'pry' - gem 'rspec-rails', '~> 4.0.0' - gem 'factory_girl_rails', '~> 4.5' + gem 'rspec-rails' + gem 'factory_girl_rails', '~> 4.9' gem 'launchy', '~> 2.4', '>= 2.4.3' gem 'capybara', '~> 2.15.4' gem 'poltergeist', '~> 1.9.0' gem 'phantomjs' gem 'shoulda-whenever', '~> 0.0.2' - gem 'bullet', '5.4.3' + gem 'bullet', '~> 6.1' gem 'mongoid-rspec', '~> 4.0', '>= 4.0.1' gem 'thin', '~> 1.7' gem 'danger', '~> 5.16', '>= 5.16.1' @@ -102,7 +112,7 @@ end group :development do gem 'letter_opener', '~> 1.4.1' - gem 'letter_opener_web', '~> 1.3', '>= 1.3.4' + gem 'letter_opener_web' gem 'rubocop', '~> 0.47.1', require: false gem 'capistrano', '3.9.0' gem 'capistrano-rails', '~> 1.1.1' @@ -125,3 +135,4 @@ group :test do end gem "sentry-raven", "~> 2.13" +gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] diff --git a/Gemfile.lock b/Gemfile.lock index 2dc7009216..26b9082453 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,98 +1,120 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (2.3.6) - actionmailer (4.2.2) - actionpack (= 4.2.2) - actionview (= 4.2.2) - activejob (= 4.2.2) + actioncable (5.2.4.4) + actionpack (= 5.2.4.4) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.2) - actionview (= 4.2.2) - activesupport (= 4.2.2) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - actionview (4.2.2) - activesupport (= 4.2.2) + rails-dom-testing (~> 2.0) + actionpack (5.2.4.4) + actionview (= 5.2.4.4) + activesupport (= 5.2.4.4) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionpack-action_caching (1.2.1) + actionpack (>= 4.0.0) + actionpack-page_caching (1.2.3) + actionpack (>= 5.0.0) + actionview (5.2.4.4) + activesupport (= 5.2.4.4) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - active_model_serializers (0.9.4) - activemodel (>= 3.2) - active_record_union (1.2.0) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + active_model_serializers (0.10.11) + actionpack (>= 4.1, < 6.1) + activemodel (>= 4.1, < 6.1) + case_transform (>= 0.2) + jsonapi-renderer (>= 0.1.1.beta1, < 0.3) + active_record_union (1.3.0) activerecord (>= 4.0) - activejob (4.2.2) - activesupport (= 4.2.2) - globalid (>= 0.3.0) - activemodel (4.2.2) - activesupport (= 4.2.2) + activejob (5.2.4.4) + activesupport (= 5.2.4.4) + globalid (>= 0.3.6) + activemodel (5.2.4.4) + activesupport (= 5.2.4.4) + activemodel-serializers-xml (1.0.2) + activemodel (> 5.x) + activesupport (> 5.x) builder (~> 3.1) - activerecord (4.2.2) - activemodel (= 4.2.2) - activesupport (= 4.2.2) - arel (~> 6.0) - activesupport (4.2.2) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) + activerecord (5.2.4.4) + activemodel (= 5.2.4.4) + activesupport (= 5.2.4.4) + arel (>= 9.0) + activestorage (5.2.4.4) + actionpack (= 5.2.4.4) + activerecord (= 5.2.4.4) + marcel (~> 0.3.1) + activesupport (5.2.4.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - acts_as_paranoid (0.6.1) - activerecord (>= 4.2, < 7.0) - activesupport (>= 4.2, < 7.0) - addressable (2.4.0) - airbrussh (1.3.2) + acts_as_paranoid (0.7.0) + activerecord (>= 5.2, < 7.0) + activesupport (>= 5.2, < 7.0) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) - ancestry (3.0.5) - activerecord (>= 3.2.0) - apartment (1.2.0) + ancestry (3.2.1) + activerecord (>= 4.2.0) + apartment (2.2.1) activerecord (>= 3.1.2, < 6.0) + parallel (>= 0.7.1) + public_suffix (>= 2) rack (>= 1.3.6) appsignal (1.1.9) rack thread_safe - arel (6.0.3) - asset_sync (2.8.1) + arel (9.0.0) + asset_sync (2.12.1) activemodel (>= 4.1.0) fog-core mime-types (>= 2.99) unf - ast (2.3.0) - autoprefixer-rails (6.3.3.1) + ast (2.4.1) + autoprefixer-rails (10.1.0.0) execjs - autosize-rails (1.18.17) - rails (>= 3.1) babel-source (5.8.35) babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) execjs (~> 2.0) - bbcoder (1.1.1) - bcrypt (3.1.13) - bootstrap-datepicker-rails (1.5.0) + bcrypt (3.1.16) + bcrypt (3.1.16-java) + bootsnap (1.5.1) + msgpack (~> 1.0) + bootsnap (1.5.1-java) + msgpack (~> 1.0) + bootstrap-datepicker-rails (1.9.0.1) railties (>= 3.0) - bootstrap-sass (3.3.6) + bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) - sass (>= 3.3.4) - bourbon (4.2.7) - sass (~> 3.4) - thor (~> 0.19) - browser (2.1.0) - bson (4.2.1) + sassc (>= 2.0.0) + bourbon (7.0.0) + thor (~> 1.0) + browser (5.1.0) + bson (4.11.1) + bson (4.11.1-java) builder (3.2.4) - bullet (5.4.3) + bullet (6.1.0) activesupport (>= 3.0.0) - uniform_notifier (~> 1.10.0) - cancancan (1.13.1) + uniform_notifier (~> 1.11) + byebug (11.1.3) + cancancan (3.1.0) capistrano (3.9.0) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) sshkit (>= 1.9.0) - capistrano-bundler (1.5.0) + capistrano-bundler (1.6.0) capistrano (~> 3.1) capistrano-foreman (1.4.0) capistrano (~> 3.1) @@ -115,15 +137,21 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - carrierwave (1.1.0) - activemodel (>= 4.0.0) - activesupport (>= 4.0.0) - mime-types (>= 1.16) - caxlsx (2.0.2) - htmlentities (~> 4.3.1) - nokogiri (>= 1.4.1) - rubyzip (~> 1.2) - chartkick (3.4.0) + carrierwave (2.1.0) + activemodel (>= 5.0.0) + activesupport (>= 5.0.0) + addressable (~> 2.6) + image_processing (~> 1.1) + mimemagic (>= 0.3.0) + mini_mime (>= 0.1.3) + case_transform (0.2) + activesupport + caxlsx (3.0.3) + htmlentities (~> 4.3, >= 4.3.4) + mimemagic (~> 0.3) + nokogiri (~> 1.10, >= 1.10.4) + rubyzip (>= 1.3.0, < 3) + chartkick (3.4.2) choice (0.2.0) chronic (0.10.2) claide (1.0.3) @@ -132,22 +160,23 @@ GEM nap open4 (~> 1.3) cliver (0.3.2) - cocoon (1.2.9) - coderay (1.1.1) - coffee-rails (4.1.1) + cocoon (1.2.15) + coderay (1.1.3) + coffee-rails (5.0.0) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.1.x) + railties (>= 5.2.0) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.10.0) + coffee-script-source (1.12.2) colored2 (3.1.2) concurrent-ruby (1.1.7) - connection_pool (2.2.0) + connection_pool (2.2.3) cork (0.3.0) colored2 (~> 3.1) crass (1.0.6) daemons (1.3.1) + dalli (2.7.11) danger (5.16.1) claide (~> 1.0) claide-plugins (>= 0.9.2) @@ -160,60 +189,64 @@ GEM no_proxy_fix octokit (~> 4.7) terminal-table (~> 1) - database_cleaner (1.5.1) - datagrid (1.4.2) - rails (>= 3.2.22.2) - db_text_search (0.2.0) - activerecord (>= 4.1.15, < 6.0) - declarative (0.0.9) + database_cleaner (1.8.5) + datagrid (1.6.1) + rails (>= 4.0) + db_text_search (0.3.1) + activerecord (>= 4.1.15, < 7.0) + declarative (0.0.20) declarative-option (0.1.0) - devise (3.5.6) + devise (4.7.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) + railties (>= 4.1.0) responders - thread_safe (~> 0.1) warden (~> 1.2.3) - devise_token_auth (0.1.43) - devise (> 3.5.2, < 4.5) - rails (< 6) + devise_token_auth (1.1.3) + bcrypt (~> 3.0) + devise (> 3.5.2, < 5) + rails (>= 4.2.0, < 6.1) diff-lcs (1.4.4) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - doorkeeper (4.4.3) - railties (>= 4.2) - dotenv (2.0.2) - dotenv-rails (2.0.2) - dotenv (= 2.0.2) - railties (~> 4.0) - dotiw (4.0.1) - actionpack (>= 4) + doorkeeper (5.4.0) + railties (>= 5) + dotenv (2.7.6) + dotenv-rails (2.7.6) + dotenv (= 2.7.6) + railties (>= 3.2) + dotiw (5.2.0) + activesupport i18n - draper (2.1.0) - actionpack (>= 3.0) - activemodel (>= 3.0) - activesupport (>= 3.0) - request_store (~> 1.0) - dropzonejs-rails (0.7.4) + draper (4.0.1) + actionpack (>= 5.0) + activemodel (>= 5.0) + activemodel-serializers-xml (>= 1.0) + activesupport (>= 5.0) + request_store (>= 1.0) + dropzonejs-rails (0.8.5) rails (> 3.1) - dry-inflector (0.1.2) enumerize (2.3.1) activesupport (>= 3.2) + erubi (1.10.0) erubis (2.7.0) - ethon (0.8.1) + ethon (0.12.0) ffi (>= 1.3.0) eventmachine (1.2.7) - excon (0.73.0) - execjs (2.6.0) - factory_girl (4.5.0) + eventmachine (1.2.7-java) + eventmachine (1.2.7-x64-mingw32) + eventmachine (1.2.7-x86-mingw32) + excon (0.78.1) + execjs (2.7.0) + factory_girl (4.9.0) activesupport (>= 3.0.0) - factory_girl_rails (4.6.0) - factory_girl (~> 4.5.0) + factory_girl_rails (4.9.0) + factory_girl (~> 4.9.0) railties (>= 3.0.0) - faraday (0.12.1) + faraday (0.17.3) multipart-post (>= 1.2, < 3) - faraday-cookie_jar (0.0.6) - faraday (>= 0.7.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) http-cookie (~> 1.0.0) faraday-encoding (0.0.5) faraday @@ -221,217 +254,79 @@ GEM faraday (~> 0.8) faraday_middleware (0.14.0) faraday (>= 0.7.4, < 1.0) - fastimage (2.1.7) - ffaker (2.1.0) - ffi (1.9.10) - fission (0.5.0) - CFPropertyList (~> 2.2) + fastimage (2.2.0) + ffaker (2.17.0) + ffi (1.13.1) + ffi (1.13.1-java) + ffi (1.13.1-x64-mingw32) + ffi (1.13.1-x86-mingw32) flay (2.12.1) erubis (~> 2.7.0) path_expander (~> 1.0) ruby_parser (~> 3.0) sexp_processor (~> 4.0) - fog (1.41.0) - fog-aliyun (>= 0.1.0) - fog-atmos - fog-aws (>= 0.6.0) - fog-brightbox (~> 0.4) - fog-cloudatcost (~> 0.1.0) - fog-core (~> 1.45) - fog-digitalocean (>= 0.3.0) - fog-dnsimple (~> 1.0) - fog-dynect (~> 0.0.2) - fog-ecloud (~> 0.1) - fog-google (<= 0.1.0) - fog-internet-archive - fog-joyent - fog-json - fog-local - fog-openstack - fog-powerdns (>= 0.1.1) - fog-profitbricks - fog-rackspace - fog-radosgw (>= 0.0.2) - fog-riakcs - fog-sakuracloud (>= 0.0.4) - fog-serverlove - fog-softlayer - fog-storm_on_demand - fog-terremark - fog-vmfusion - fog-voxel - fog-vsphere (>= 0.4.0) - fog-xenserver - fog-xml (~> 0.1.1) - ipaddress (~> 0.5) - json (>= 1.8, < 2.0) - fog-aliyun (0.3.5) - fog-core - fog-json - ipaddress (~> 0.8) - xml-simple (~> 1.1) - fog-atmos (0.1.0) - fog-core - fog-xml - fog-aws (2.0.1) - fog-core (~> 1.38) - fog-json (~> 1.0) - fog-xml (~> 0.1) - ipaddress (~> 0.8) - fog-brightbox (0.16.1) - dry-inflector - fog-core - fog-json - mime-types - fog-cloudatcost (0.1.2) - fog-core (~> 1.36) - fog-json (~> 1.0) + fog-aws (3.7.0) + fog-core (~> 2.1) + fog-json (~> 1.1) fog-xml (~> 0.1) ipaddress (~> 0.8) - fog-core (1.45.0) + fog-core (2.2.3) builder - excon (~> 0.58) + excon (~> 0.71) formatador (~> 0.2) - fog-digitalocean (0.4.0) - fog-core - fog-json - fog-xml - ipaddress (>= 0.5) - fog-dnsimple (1.0.0) - fog-core (~> 1.38) - fog-json (~> 1.0) - fog-dynect (0.0.3) - fog-core - fog-json - fog-xml - fog-ecloud (0.3.0) - fog-core - fog-xml - fog-google (0.1.0) - fog-core - fog-json - fog-xml - fog-internet-archive (0.0.1) - fog-core - fog-json - fog-xml - fog-joyent (0.0.1) - fog-core (~> 1.42) - fog-json (>= 1.0) + mime-types fog-json (1.2.0) fog-core multi_json (~> 1.10) - fog-local (0.6.0) - fog-core (>= 1.27, < 3.0) - fog-openstack (0.3.10) - fog-core (>= 1.45, <= 2.1.0) - fog-json (>= 1.0) - ipaddress (>= 0.8) - fog-powerdns (0.2.0) - fog-core - fog-json - fog-xml - fog-profitbricks (4.1.1) - fog-core (~> 1.42) - fog-json (~> 1.0) - fog-rackspace (0.1.6) - fog-core (>= 1.35) - fog-json (>= 1.0) - fog-xml (>= 0.1) - ipaddress (>= 0.8) - fog-radosgw (0.0.5) - fog-core (>= 1.21.0) - fog-json - fog-xml (>= 0.0.1) - fog-riakcs (0.1.0) - fog-core - fog-json - fog-xml - fog-sakuracloud (1.7.5) - fog-core - fog-json - fog-serverlove (0.1.2) - fog-core - fog-json - fog-softlayer (1.1.4) - fog-core - fog-json - fog-storm_on_demand (0.1.1) - fog-core - fog-json - fog-terremark (0.1.0) - fog-core - fog-xml - fog-vmfusion (0.1.0) - fission - fog-core - fog-voxel (0.1.0) - fog-core - fog-xml - fog-vsphere (3.3.0) - fog-core - rbvmomi (>= 1.9, < 3) - fog-xenserver (1.0.0) - fog-core - fog-xml - xmlrpc fog-xml (0.1.3) fog-core nokogiri (>= 1.5.11, < 2.0.0) - font-awesome-rails (4.7.0.0) - railties (>= 3.2, < 5.1) - foreman (0.78.0) - thor (~> 0.19.1) + font-awesome-rails (4.7.0.5) + railties (>= 3.2, < 6.1) + foreman (0.87.2) formatador (0.2.5) - friendly_id (5.1.0) + friendly_id (5.4.1) activerecord (>= 4.0.0) - fullcalendar-rails (3.2.0.0) + fullcalendar-rails (3.9.0.0) jquery-rails (>= 4.0.5, < 5.0.0) jquery-ui-rails (>= 5.0.2) momentjs-rails (>= 2.9.0) - gemoji (2.1.0) git (1.7.0) rchardet (~> 1.8) - github-markdown (0.6.9) - globalid (0.3.6) - activesupport (>= 4.1.0) - globalize (5.1.0) - activemodel (>= 4.2, < 5.2) - activerecord (>= 4.2, < 5.2) + globalid (0.4.2) + activesupport (>= 4.2.0) + globalize (5.3.0) + activemodel (>= 4.2, < 6.1) + activerecord (>= 4.2, < 6.1) request_store (~> 1.0) - google-api-client (0.10.3) - addressable (~> 2.3) - googleauth (~> 0.5) - httpclient (~> 2.7) - hurley (~> 0.1) - memoist (~> 0.11) - mime-types (>= 1.6) + google-api-client (0.23.9) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.5, < 0.7.0) + httpclient (>= 2.8.1, < 3.0) + mime-types (~> 3.0) representable (~> 3.0) retriable (>= 2.0, < 4.0) - googleauth (0.5.1) - faraday (~> 0.9) - jwt (~> 1.4) - logging (~> 2.0) - memoist (~> 0.12) + signet (~> 0.9) + googleauth (0.6.7) + faraday (~> 0.12) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) multi_json (~> 1.11) - os (~> 0.9) + os (>= 0.9, < 2.0) signet (~> 0.7) - haml (4.0.7) + haml (5.2.1) + temple (>= 0.8.0) tilt - haml-rails (0.9.0) - actionpack (>= 4.0.1) - activesupport (>= 4.0.1) - haml (>= 4.0.6, < 5.0) + haml-rails (2.0.1) + actionpack (>= 5.1) + activesupport (>= 5.1) + haml (>= 4.0.6, < 6.0) html2haml (>= 1.0.1) - railties (>= 4.0.1) - hashie (3.4.3) - html-pipeline (2.4.2) + railties (>= 5.1) + hashie (4.1.0) + html-pipeline (2.14.0) activesupport (>= 2) nokogiri (>= 1.4) - html-pipeline-vimeo (0.1.1) - html-pipeline (~> 2.0) - html-pipeline-youtube (0.1.3) - html-pipeline (~> 2.0) html2haml (2.2.0) erubis (~> 2.7.0) haml (>= 4.0, < 6) @@ -441,39 +336,40 @@ GEM http-cookie (1.0.3) domain_name (~> 0.5) httpclient (2.8.3) - hurley (0.2) - i18n (0.9.5) + i18n (1.8.5) concurrent-ruby (~> 1.0) - inline_svg (1.7.1) + image_processing (1.12.1) + mini_magick (>= 4.9.5, < 5) + ruby-vips (>= 2.0.17, < 3) + inline_svg (1.7.2) activesupport (>= 3.0) nokogiri (>= 1.6) ipaddress (0.8.3) - jbuilder (2.4.1) - activesupport (>= 3.0.0, < 5.1) - multi_json (~> 1.2) + jbuilder (2.10.1) + activesupport (>= 5.0.0) jquery-datatables-rails (3.4.0) actionpack (>= 3.1) jquery-rails railties (>= 3.1) sass-rails - jquery-rails (4.1.0) - rails-dom-testing (~> 1.0) + jquery-rails (4.4.0) + rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - jquery-validation-rails (1.13.1) - railties (>= 3.2, < 5.0) - thor (~> 0.14) + jquery-validation-rails (1.19.0) jquery_query_builder-rails (0.5.0) activesupport json (>= 1.8.3) railties (>= 3.1) - json (1.8.6) + json (2.3.1) + json (2.3.1-java) json_spec (1.1.5) multi_json (~> 1.0) rspec (>= 2.0, < 4.0) - jwt (1.5.6) + jsonapi-renderer (0.2.2) + jwt (2.2.2) kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -489,24 +385,26 @@ GEM kramdown (1.17.0) launchy (2.4.3) addressable (~> 2.3) + launchy (2.4.3-java) + addressable (~> 2.3) + spoon (~> 0.0.1) letter_opener (1.4.1) launchy (~> 2.2) letter_opener_web (1.3.4) actionmailer (>= 3.2) letter_opener (~> 1.0) railties (>= 3.2) - little-plugger (1.1.4) - logging (2.2.2) - little-plugger (~> 1.1) - multi_json (~> 1.10) - loofah (2.7.0) + libv8 (8.4.255.0) + loofah (2.8.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) + mail (2.7.1) + mini_mime (>= 0.1.1) mail_interceptor (0.0.7) activesupport - memoist (0.15.0) + marcel (0.3.3) + mimemagic (~> 0.3.2) + memoist (0.16.2) metainspector (5.4.0) addressable (~> 2.4) faraday (~> 0.9) @@ -517,21 +415,24 @@ GEM fastimage (~> 2.0) nesty (~> 1.0) nokogiri (~> 1.6) - method_source (0.8.2) - mime-types (2.99.1) - mini_magick (4.5.1) - mini_mime (0.1.4) + method_source (1.0.0) + mime-types (3.3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2020.1104) + mimemagic (0.3.5) + mini_magick (4.11.0) + mini_mime (1.0.2) mini_portile2 (2.4.0) + mini_racer (0.3.1) + libv8 (~> 8.4.255) minitest (5.14.2) - momentjs-rails (2.17.1) + momentjs-rails (2.20.1) railties (>= 3.1) - mongo (2.4.1) - bson (>= 4.2.1, < 5.0.0) - mongoid (5.2.1) - activemodel (~> 4.0) + mongo (2.14.0) + bson (>= 4.8.2, < 5.0.0) + mongoid (6.1.1) + activemodel (~> 5.0) mongo (>= 2.4.1, < 3.0.0) - origin (~> 2.3) - tzinfo (>= 0.3.37) mongoid-compatibility (0.5.1) activesupport mongoid (>= 2.0) @@ -542,143 +443,172 @@ GEM rspec-core (~> 3.3) rspec-expectations (~> 3.3) rspec-mocks (~> 3.3) - multi_json (1.14.1) - multipart-post (2.0.0) + msgpack (1.3.3) + msgpack (1.3.3-java) + msgpack (1.3.3-x64-mingw32) + msgpack (1.3.3-x86-mingw32) + multi_json (1.15.0) + multipart-post (2.1.1) + mustache (1.1.1) + mustermann (1.1.1) + ruby2_keywords (~> 0.0.1) nap (1.1.0) - neat (1.8.0) + neat (1.7.4) + bourbon (>= 4.0) sass (>= 3.3) - thor (~> 0.19) nesty (1.0.2) - net-scp (2.0.0) - net-ssh (>= 2.6.5, < 6.0.0) - net-ssh (5.2.0) + net-scp (3.0.0) + net-ssh (>= 2.6.5, < 7.0.0) + net-ssh (6.1.0) + nio4r (2.5.4) + nio4r (2.5.4-java) no_proxy_fix (0.1.2) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) - nokogumbo (2.0.2) + nokogiri (1.10.10-java) + nokogiri (1.10.10-x64-mingw32) + mini_portile2 (~> 2.4.0) + nokogiri (1.10.10-x86-mingw32) + mini_portile2 (~> 2.4.0) + nokogumbo (2.0.4) nokogiri (~> 1.8, >= 1.8.4) octokit (4.19.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) - omniauth (1.3.1) - hashie (>= 1.2, < 4) - rack (>= 1.0, < 3) + omniauth (1.9.1) + hashie (>= 3.4.6) + rack (>= 1.6.2, < 3) + onebox (1.9.30) + addressable (~> 2.7.0) + htmlentities (~> 4.3) + multi_json (~> 1.11) + mustache + nokogiri (~> 1.7) + sanitize open4 (1.3.4) - optimist (3.0.0) - origin (2.3.0) orm_adapter (0.5.0) - os (0.9.6) - paper_trail (5.2.2) - activerecord (>= 3.0, < 6.0) + os (1.1.1) + paper_trail (10.3.1) + activerecord (>= 4.2) request_store (~> 1.1) - parser (2.3.3.1) - ast (~> 2.2) + paper_trail-association_tracking (2.1.1) + parallel (1.20.1) + parser (2.7.2.0) + ast (~> 2.4.1) path_expander (1.1.0) pg (0.18.4) + pg (0.18.4-x64-mingw32) + pg (0.18.4-x86-mingw32) phantomjs (2.1.1.0) - phony (2.15.15) - phony_rails (0.12.13) + phony (2.18.18) + phony_rails (0.14.13) activesupport (>= 3.0) - phony (~> 2.12) + phony (> 2.15) poltergeist (1.9.0) capybara (~> 2.1) cliver (~> 0.3.1) multi_json (~> 1.0) websocket-driver (>= 0.2.0) - powerpack (0.1.1) - proxies (0.2.1) - pry (0.10.3) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - pundit (1.1.0) + powerpack (0.1.3) + proxies (0.2.3) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + pry (0.13.1-java) + coderay (~> 1.1) + method_source (~> 1.0) + spoon (~> 0.0) + public_suffix (4.0.6) + puma (3.12.6) + puma (3.12.6-java) + pundit (2.1.0) activesupport (>= 3.0.0) - rack (1.6.13) - rack-cors (1.0.6) - rack (>= 1.6.0) - rack-mini-profiler (1.0.0) + rack (2.2.3) + rack-cors (1.1.1) + rack (>= 2.0.0) + rack-mini-profiler (1.1.6) rack (>= 1.2.0) - rack-protection (1.5.3) + rack-protection (2.1.0) rack rack-proxy (0.6.5) rack - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.2) - actionmailer (= 4.2.2) - actionpack (= 4.2.2) - actionview (= 4.2.2) - activejob (= 4.2.2) - activemodel (= 4.2.2) - activerecord (= 4.2.2) - activesupport (= 4.2.2) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.2) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.9) - activesupport (>= 4.2.0, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) - rails-erd (1.4.6) - activerecord (>= 3.2) - activesupport (>= 3.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.2.4.4) + actioncable (= 5.2.4.4) + actionmailer (= 5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) + activemodel (= 5.2.4.4) + activerecord (= 5.2.4.4) + activestorage (= 5.2.4.4) + activesupport (= 5.2.4.4) + bundler (>= 1.3.0) + railties (= 5.2.4.4) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-erd (1.6.0) + activerecord (>= 4.2) + activesupport (>= 4.2) choice (~> 0.2.0) ruby-graphviz (~> 1.2) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - rails-timeago (2.14.0) - actionpack (>= 3.1) - activesupport (>= 3.1) - railties (4.2.2) - actionpack (= 4.2.2) - activesupport (= 4.2.2) + railties (5.2.4.4) + actionpack (= 5.2.4.4) + activesupport (= 5.2.4.4) + method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rainbow (2.2.1) + thor (>= 0.19.0, < 2.0) + rainbow (2.2.2) + rake rake (13.0.1) - rb-gravatar (1.0.5) - rbvmomi (2.4.1) - builder (~> 3.0) - json (>= 1.8) - nokogiri (~> 1.5) - optimist (~> 3.0) + rb-fsevent (0.10.4) + rb-gravatar (1.0.6) + rb-inotify (0.10.1) + ffi (~> 1.0) rchardet (1.8.0) - react-rails (2.6.0) + react-rails (2.6.1) babel-transpiler (>= 0.7.0) connection_pool execjs railties (>= 3.2) tilt - redis (3.2.2) + redis (4.1.4) representable (3.0.4) declarative (< 0.1.0) declarative-option (< 0.2.0) uber (< 0.2.0) - request_store (1.3.0) - responders (2.1.1) - railties (>= 4.2.0, < 5.1) - retriable (3.0.2) - roo (2.3.2) + request_store (1.5.0) + rack (>= 1.4) + responders (3.0.1) + actionpack (>= 5.0) + railties (>= 5.0) + retriable (3.1.2) + rexml (3.2.4) + rinku (2.0.6) + roo (2.8.3) nokogiri (~> 1) - rubyzip (~> 1.1, < 2.0.0) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) + rubyzip (>= 1.3.0, < 3.0.0) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) rspec-activemodel-mocks (1.1.0) activemodel (>= 3.0) activesupport (>= 3.0) rspec-mocks (>= 2.99, < 4.0) - rspec-core (3.9.3) - rspec-support (~> 3.9.3) - rspec-expectations (3.9.3) + rspec-core (3.10.0) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.1) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) + rspec-support (~> 3.10.0) rspec-rails (4.0.1) actionpack (>= 4.2) activesupport (>= 4.2) @@ -690,172 +620,202 @@ GEM rspec-sidekiq (3.1.0) rspec-core (~> 3.0, >= 3.0.0) sidekiq (>= 2.4.0) - rspec-support (3.9.4) + rspec-support (3.10.0) rubocop (0.47.1) parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) - ruby-graphviz (1.2.2) - ruby-ole (1.2.12) - ruby-progressbar (1.8.1) - ruby_parser (3.14.2) + ruby-graphviz (1.2.5) + rexml + ruby-ole (1.2.12.2) + ruby-progressbar (1.10.1) + ruby-vips (2.0.17) + ffi (~> 1.9) + ruby2_keywords (0.0.2) + ruby_parser (3.15.0) sexp_processor (~> 4.9) - rubyzip (1.2.0) - s3 (0.3.24) - proxies (~> 0.2.0) + rubyzip (2.3.0) + s3 (0.3.29) + addressable + proxies sanitize (5.2.1) crass (~> 1.0.2) nokogiri (>= 1.8.0) nokogumbo (~> 2.0) - sass (3.4.21) - sass-rails (5.0.4) - railties (>= 4.0.0, < 5.0) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc (2.4.0-x64-mingw32) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt sawyer (0.8.2) addressable (>= 2.3.5) faraday (> 0.8, < 2.0) - select2-rails (3.5.9.3) - thor (~> 0.14) + select2-rails (4.0.13) + semantic_range (2.3.1) sentry-raven (2.13.0) faraday (>= 0.7.6, < 1.0) - sexp_processor (4.14.1) - shoulda-matchers (3.1.1) - activesupport (>= 4.0.0) + sexp_processor (4.15.1) + shoulda-matchers (4.0.1) + activesupport (>= 4.2.0) shoulda-whenever (0.0.2) - sidekiq (4.1.0) - concurrent-ruby (~> 1.0) - connection_pool (~> 2.2, >= 2.2.0) - redis (~> 3.2, >= 3.2.1) - signet (0.7.3) + sidekiq (5.2.9) + connection_pool (~> 2.2, >= 2.2.2) + rack (~> 2.0) + rack-protection (>= 1.5.0) + redis (>= 3.3.5, < 4.2) + signet (0.14.0) addressable (~> 2.3) - faraday (~> 0.9) - jwt (~> 1.5) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.5, < 3.0) multi_json (~> 1.10) - simple_form (3.2.1) - actionpack (> 4, < 5.1) - activemodel (> 4, < 5.1) - sinatra (1.4.7) - rack (~> 1.5) - rack-protection (~> 1.4) - tilt (>= 1.3, < 3) - slop (3.6.0) + simple_form (5.0.3) + actionpack (>= 5.0) + activemodel (>= 5.0) + sinatra (2.1.0) + mustermann (~> 1.0) + rack (~> 2.2) + rack-protection (= 2.1.0) + tilt (~> 2.0) sorbet-rails (0.4.0) - spreadsheet (1.1.3) + spoon (0.0.6) + ffi + spreadsheet (1.2.6) ruby-ole (>= 1.0) - sprockets (3.5.2) + sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-es6 (0.9.1) + sprockets-es6 (0.9.2) babel-source (>= 5.8.11) babel-transpiler sprockets (>= 3.0.0) - sprockets-rails (3.0.4) + sprockets-rails (3.2.2) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sshkit (1.18.2) + sshkit (1.21.1) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) sysrandom (1.0.5) + sysrandom (1.0.5-java) + temple (0.8.2) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) text (1.3.1) - thin (1.7.2) + thin (1.8.0) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) - thor (0.19.1) + thor (1.0.1) thread_safe (0.3.6) - thredded (0.6.2) - active_record_union (>= 1.2.0) + thread_safe (0.3.6-java) + thredded (0.16.4) + active_record_union (>= 1.3.0) autoprefixer-rails - autosize-rails - bbcoder (~> 1.0) - db_text_search (~> 0.2.0) + db_text_search (~> 0.3.0) friendly_id - gemoji - github-markdown html-pipeline - html-pipeline-vimeo - html-pipeline-youtube htmlentities inline_svg - jquery-rails kaminari + kramdown (>= 1.17.0) nokogiri + onebox (~> 1.8, >= 1.8.48) pundit (>= 1.1.0) - rails (>= 4.2.0) - rails-timeago + rails (>= 4.2.10) rb-gravatar + rinku sanitize - sass (>= 3.4.21) - select2-rails (~> 3.5) + sassc-rails (>= 2.0.0) sprockets-es6 + timeago_js tilt (2.0.10) + timeago_js (3.0.2.2) timecop (0.8.1) - tinymce-rails (4.5.6) + tinymce-rails (5.6.2.1) railties (>= 3.1.1) - typhoeus (1.0.1) - ethon (>= 0.8.0) - tzinfo (1.2.7) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (1.2.8) thread_safe (~> 0.1) + tzinfo-data (1.2020.4) + tzinfo (>= 1.0.0) uber (0.1.0) - uglifier (2.7.2) - execjs (>= 0.3.0) - json (>= 1.8.0) + uglifier (4.2.0) + execjs (>= 0.3.0, < 3) ulid (1.2.0) unf (0.1.4) unf_ext - unf_ext (0.0.7.6) - unicode-display_width (1.1.3) - uniform_notifier (1.10.0) - warden (1.2.6) - rack (>= 1.0) - webpacker (4.0.7) - activesupport (>= 4.2) + unf (0.1.4-java) + unf_ext (0.0.7.7) + unf_ext (0.0.7.7-x64-mingw32) + unf_ext (0.0.7.7-x86-mingw32) + unicode-display_width (1.7.0) + uniform_notifier (1.13.0) + warden (1.2.9) + rack (>= 2.0.9) + webpacker (5.2.1) + activesupport (>= 5.2) rack-proxy (>= 0.6.1) - railties (>= 4.2) - websocket-driver (0.7.0) + railties (>= 5.2) + semantic_range (>= 2.3.0) + websocket-driver (0.7.3) + websocket-extensions (>= 0.1.0) + websocket-driver (0.7.3-java) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - whenever (0.9.7) + whenever (1.0.0) chronic (>= 0.6.3) - where-or (0.1.6) - wicked_pdf (1.0.6) - wkhtmltopdf-binary-edge (0.12.3.0) - write_xlsx (0.85.7) + wicked_pdf (2.1.0) + activesupport + wkhtmltopdf-binary-edge (0.12.6.0) + write_xlsx (0.86.0) rubyzip (>= 1.0.0) zip-zip x-editable-rails (1.5.5.1) railties - xml-simple (1.1.5) - xmlrpc (0.3.0) xpath (2.1.0) nokogiri (~> 1.3) zip-zip (0.3) rubyzip (>= 1.0.0) PLATFORMS + java ruby + x64-mingw32 + x86-mingw32 + x86-mswin32 DEPENDENCIES + actionpack-action_caching (~> 1.2, >= 1.2.1) + actionpack-page_caching (~> 1.2, >= 1.2.3) active_model_serializers - acts_as_paranoid (~> 0.6.1) - ancestry (~> 3.0, >= 3.0.5) - apartment (~> 1.2) + acts_as_paranoid (~> 0.7.0) + ancestry (~> 3.2, >= 3.2.1) + apartment (~> 2.2, >= 2.2.1) appsignal (~> 1.1.9) asset_sync - bootstrap-datepicker-rails (~> 1.5) - bootstrap-sass (~> 3.3.5) - bourbon (~> 4.2) - browser (~> 2.1) - bullet (= 5.4.3) - cancancan (~> 1.13, >= 1.13.1) + bootsnap (>= 1.1.0) + bootstrap-datepicker-rails (~> 1.9, >= 1.9.0.1) + bootstrap-sass (~> 3.4, >= 3.4.1) + bourbon (~> 7.0) + browser (~> 5.1) + bullet (~> 6.1) + byebug + cancancan (~> 3.1) capistrano (= 3.9.0) capistrano-foreman capistrano-passenger (~> 0.1.1) @@ -863,34 +823,35 @@ DEPENDENCIES capistrano-rvm (~> 0.1.2) capistrano-sidekiq (~> 1.0, >= 1.0.3) capybara (~> 2.15.4) - carrierwave (~> 1.1.0) - caxlsx (~> 2.0, >= 2.0.2) - chartkick (~> 3.4) - cocoon (~> 1.2, >= 1.2.9) - coffee-rails (~> 4.1.0) + carrierwave (~> 2.1) + caxlsx (~> 3.0, >= 3.0.3) + chartkick (~> 3.4, >= 3.4.2) + cocoon (~> 1.2, >= 1.2.15) + coffee-rails (~> 5.0) + dalli (~> 2.7, >= 2.7.11) danger (~> 5.16, >= 5.16.1) database_cleaner (~> 1.5, >= 1.5.1) - datagrid (~> 1.4.2) - devise (~> 3.5, >= 3.5.2) - devise_token_auth (~> 0.1.37) - doorkeeper (~> 4.4, >= 4.4.3) - dotenv-rails (~> 2.0.2) - dotiw (~> 4.0.1) - draper (~> 2.1) - dropzonejs-rails (~> 0.7.3) - enumerize (~> 2.3.1) - factory_girl_rails (~> 4.5) - ffaker (~> 2.1.0) + datagrid (~> 1.6, >= 1.6.1) + devise (~> 4.7, >= 4.7.3) + devise_token_auth + doorkeeper (~> 5.4) + dotenv-rails (~> 2.7, >= 2.7.6) + dotiw (~> 5.2) + draper (~> 4.0, >= 4.0.1) + dropzonejs-rails (~> 0.8.5) + enumerize (~> 2.3, >= 2.3.1) + factory_girl_rails (~> 4.9) + ffaker (~> 2.17) flay (~> 2.12, >= 2.12.1) - fog - font-awesome-rails (~> 4.7) - foreman (~> 0.78.0) - friendly_id (~> 5.1.0) - fullcalendar-rails (~> 3.2.0.0) - globalize (~> 5.1.0) - google-api-client (~> 0.10) - haml-rails (~> 0.9) - jbuilder (~> 2.0) + fog-aws (~> 3.3) + font-awesome-rails (~> 4.7, >= 4.7.0.5) + foreman (~> 0.87.2) + friendly_id (~> 5.4, >= 5.4.1) + fullcalendar-rails (~> 3.9) + globalize (~> 5.3) + google-api-client (~> 0.23.9) + haml-rails (~> 2.0, >= 2.0.1) + jbuilder (~> 2.10, >= 2.10.1) jquery-datatables-rails (~> 3.4) jquery-rails jquery-ui-rails @@ -900,59 +861,65 @@ DEPENDENCIES kaminari launchy (~> 2.4, >= 2.4.3) letter_opener (~> 1.4.1) - letter_opener_web (~> 1.3, >= 1.3.4) + letter_opener_web mail_interceptor (~> 0.0.7) metainspector - mini_magick (~> 4.5) - momentjs-rails (~> 2.17.1) - mongoid (~> 5.2, >= 5.2.1) + mini_magick (~> 4.11) + mini_racer + momentjs-rails (~> 2.20, >= 2.20.1) + mongoid (~> 6.1, >= 6.1.1) mongoid-rspec (~> 4.0, >= 4.0.1) - neat (~> 1.8) - omniauth (~> 1.3, >= 1.3.1) - paper_trail (~> 5.2) + neat (~> 1.7, >= 1.7.4) + omniauth (~> 1.9, >= 1.9.1) + paper_trail (~> 10.0, >= 10.0.1) + paper_trail-association_tracking (~> 2.1, >= 2.1.1) pg (~> 0.18.4) phantomjs - phony_rails (~> 0.12.11) + phony_rails (~> 0.14.13) poltergeist (~> 1.9.0) pry - pundit (~> 1.1) + puma (~> 3.11) + pundit (~> 2.1) rack-cors rack-mini-profiler (~> 1.0) - rails (= 4.2.2) + rails (~> 5.2, <= 5.2.4.4) rails-erd - react-rails (~> 2.6.0) - roo (~> 2.2) + react-rails (~> 2.6, >= 2.6.1) + roo (~> 2.8, >= 2.8.3) rspec-activemodel-mocks (~> 1.1) - rspec-rails (~> 4.0.0) + rspec-rails rspec-sidekiq (~> 3.0, >= 3.0.3) rubocop (~> 0.47.1) s3 - sass-rails (~> 5.0) - select2-rails (~> 3.5.9.3) + sass-rails (~> 6.0) + select2-rails (~> 4.0, >= 4.0.13) sentry-raven (~> 2.13) shoulda-matchers shoulda-whenever (~> 0.0.2) - sidekiq (~> 4.1.0) - simple_form (~> 3.2) + sidekiq (~> 5.2, >= 5.2.9) + simple_form (~> 5.0, >= 5.0.3) sinatra sorbet-rails - spreadsheet (~> 1.1.3) + spreadsheet (~> 1.2, >= 1.2.6) sysrandom (~> 1.0, >= 1.0.5) text (~> 1.3, >= 1.3.1) thin (~> 1.7) - thredded (~> 0.6.1) + thredded (~> 0.16.4) timecop (~> 0.8.1) - tinymce-rails (~> 4.5.6) + tinymce-rails (~> 5.6, >= 5.6.2.1) typhoeus - uglifier (>= 1.3.0) + tzinfo-data + uglifier (~> 4.2) ulid (~> 1.2) - webpacker (~> 4.0.7) - whenever (~> 0.9.4) - where-or (~> 0.1.6) - wicked_pdf (~> 1.0, >= 1.0.6) - wkhtmltopdf-binary-edge (~> 0.12.3.0) - write_xlsx (~> 0.85.7) + webpacker (~> 5.2, >= 5.2.1) + whenever (~> 1.0) + wicked_pdf (~> 2.1) + wkhtmltopdf-binary-edge (~> 0.12.6.0) + write_xlsx (~> 0.86.0) x-editable-rails (~> 1.5, >= 1.5.5.1) +RUBY VERSION + ruby 2.5.3p105 + BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/app/assets/config/__init__.py b/app/assets/config/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 0000000000..b16e53d6d5 --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css diff --git a/app/assets/javascripts/advanced_filter_builder.coffee b/app/assets/javascripts/advanced_filter_builder.coffee index 512b8cba63..1839d36224 100644 --- a/app/assets/javascripts/advanced_filter_builder.coffee +++ b/app/assets/javascripts/advanced_filter_builder.coffee @@ -119,8 +119,10 @@ class CIF.AdvancedFilterBuilder month_has_changed: 'score has changed between month#' month_has_not_changed: 'score has not changed between month#' filters: @fieldList - plugins: + plugins: { + 'select2': 'select2' 'sortable': { 'inherit_no_sortable': false, 'inherit_no_drop': false } + } setRuleFromSavedSearch: -> self = @ @@ -151,5 +153,5 @@ class CIF.AdvancedFilterBuilder e.rules and e.rules.forEach(cb) return - rules.forEach(cb) + rules.forEach(cb) if rules return results diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index f076ae32ba..c8120f51ab 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,6 +1,6 @@ // FRAMEWORK //= require jquery -//= require jquery_ujs +//= require rails-ujs //= require jquery-ui //= require bootstrap-sprockets //= require jquery.steps.min @@ -13,7 +13,9 @@ //= require dataTables/dataTables.buttons.min //= require dataTables/jszip.min //= require thredded -//= require select2 +//= require select2-full +//= require select2_locale_km +//= require select2_locale_en //= require editable/bootstrap-editable //= require editable/rails @@ -134,3 +136,4 @@ //= require referees/index //= require field_settings/index //= require donors/index +//= require service_types diff --git a/app/assets/javascripts/calls/index.coffee b/app/assets/javascripts/calls/index.coffee index f54f20c4a9..4a175e63fa 100644 --- a/app/assets/javascripts/calls/index.coffee +++ b/app/assets/javascripts/calls/index.coffee @@ -47,36 +47,6 @@ CIF.CallsIndex = do -> deleteGroup: $('#builder, #wizard-builder').data('filter-translation-delete-group') $('#call-search-btn').val($('#call-search-btn').data('search')) - $.fn.queryBuilder.define 'select2', ((options) -> - if !$.fn.select2 or !$.fn.select2.constructor - Utils.error 'MissingLibrary', 'Select2 is required' - Selectors = $(".rule-operator-container [name$=_operator], .rule-filter-container [name$=_filter]") - if Selectors - @on 'afterCreateRuleFilters', (e, rule) -> - rule.$el.find(".rule-filter-container [name$=_filter]").select2 options - return - @on 'afterCreateRuleOperators', (e, rule) -> - rule.$el.find(".rule-operator-container [name$=_operator]").select2 options - return - @on 'afterUpdateRuleFilter', (e, rule) -> - rule.$el.find(".rule-filter-container [name$=_filter]").select2 options - rule.$el.find(".rule-value-container [name*=_value_]").select2(dropdownAutoWidth: true) - return - @on 'afterUpdateRuleOperator', (e, rule) -> - rule.$el.find(".rule-operator-container [name$=_operator]").select2 options - rule.$el.find(".rule-value-container [name*=_value_]").select2(dropdownAutoWidth: true) - return - @on 'beforeDeleteRule', (e, rule) -> - rule.$el.find(".rule-filter-container [name$=_filter]").select2 'destroy' - rule.$el.find(".rule-operator-container [name$=_operator]").select2 'destroy' - return - return - ), - container: 'body' - style: 'btn-inverse btn-xs' - width: '250px' - dropdownAutoWidth: true - showIcon: false filters = $("#call-builder-fields").data('fields') $('#builder').queryBuilder diff --git a/app/assets/javascripts/case_notes/form.coffee b/app/assets/javascripts/case_notes/form.coffee index 9442c15d3c..f051497cba 100644 --- a/app/assets/javascripts/case_notes/form.coffee +++ b/app/assets/javascripts/case_notes/form.coffee @@ -30,9 +30,9 @@ CIF.Case_notesNew = CIF.Case_notesCreate = CIF.Case_notesEdit = CIF.Case_notesUp $('.case_note_domain_groups .help-block').hide() $('#case_note_domain_group_ids').select2( width: '100%' - ).on('select2-selecting', (event)-> + ).on('select2:selecting', (event)-> $("#domain-#{event.val}").show('slow') - ).on('select2-removing', (event)-> + ).on('select2:unselecting', (event)-> if $("#domain-#{event.val} .task-arising .list-group-item").length > 0 event.preventDefault() $('.case_note_domain_groups .help-block').show('slow') @@ -42,7 +42,7 @@ CIF.Case_notesNew = CIF.Case_notesCreate = CIF.Case_notesEdit = CIF.Case_notesUp ).on 'change', ()-> _checkCasenoteSelectedValue(@) # $("#domain-#{e.val}").toggle('hide') if $("#domain-#{e.val} .case_note_case_note_domain_groups_tasks:visible").length == 0 - # ).on('select2-selecting', (e)-> + # ).on('select2:selecting', (e)-> # if event.target.textContent.length > 0 # $("#domain-#{e.val}").toggle('show') if $("#domain-#{e.val} .case_note_case_note_domain_groups_tasks:visible").length == 0 diff --git a/app/assets/javascripts/client_advance_search.coffee b/app/assets/javascripts/client_advance_search.coffee index 5e1e2a0b90..3e5943c2d9 100644 --- a/app/assets/javascripts/client_advance_search.coffee +++ b/app/assets/javascripts/client_advance_search.coffee @@ -53,7 +53,7 @@ class CIF.ClientAdvanceSearch filterSelectChange: -> self = @ - $('.rule-filter-container select').on 'select2-close', -> + $('.rule-filter-container select').on 'select2:close', -> ruleParentId = $(@).closest("div[id^='builder_rule']").attr('id') setTimeout ( -> $("##{ruleParentId} .rule-operator-container select, .rule-value-container select").select2(width: 'resolve') @@ -93,16 +93,23 @@ class CIF.ClientAdvanceSearch initSelect2: -> $('#custom-form-select, #wizard-custom-form-select, #program-stream-select, #wizard-program-stream-select, #quantitative-case-select').select2() - $('#builder select').select2() - $('#wizard-builder select').select2() - setTimeout ( -> - ids = ['#custom-form-select', '#wizard-custom-form-select', '#program-stream-select', '#wizard-program-stream-select', '#quantitative-case-select', '#wizard-builder', '#builder'] - $.each ids, (index, item) -> - $("#{item} .rule-filter-container select").select2(width: '250px') - $("#{item} .rule-operator-container select, .rule-value-container select").select2(width: 'resolve') - ) + # $('#builder select').select2 + # width: '250px' + + $('#wizard-builder select').select2 + width: '250px' - $('.csi-group select').select2(minimumResultsForSearch: -1).on 'select2-open', -> + # setTimeout ( -> + # ids = ['#custom-form-select', '#wizard-custom-form-select', '#program-stream-select', '#wizard-program-stream-select', '#quantitative-case-select', '#wizard-builder', '#builder'] + # $.each ids, (index, item) -> + # $("#{item} .rule-filter-container select").select2 + # width: '250px' + + # $("#{item} .rule-operator-container select, .rule-value-container select").select2 + # width: 'resolve' + # ) + + $('.csi-group select').select2(minimumResultsForSearch: -1).on 'select2:open', -> selectWrapper = $(@).closest('.csi-group') if selectWrapper.offset().top > 840 $('html, body').animate { scrollTop: selectWrapper.offset().top }, "fast" @@ -125,20 +132,20 @@ class CIF.ClientAdvanceSearch initRuleOperatorSelect2: (rowBuilderRule) -> operatorSelect = $(rowBuilderRule).find('.rule-operator-container select') - $(operatorSelect).on 'select2-close', -> + $(operatorSelect).on 'select2:close', -> setTimeout ( -> - $(rowBuilderRule).find('.rule-value-container select').select2(width: '180px') + $(rowBuilderRule).find('.rule-value-container select').select2(width: '1180px') ) ###################################################################################################################### customFormSelectChange: -> self = @ - $('.main-report-builder .custom-form-wrapper select').on 'select2-selecting', (element) -> + $('.main-report-builder .custom-form-wrapper select').on 'select2:selecting', (element) -> self.customFormSelected.push(element.val) self.addCustomBuildersFields(element.val, self.CUSTOM_FORM_URL) - $('#report-builder-wizard .custom-form-wrapper select').on 'select2-selecting', (element) -> + $('#report-builder-wizard .custom-form-wrapper select').on 'select2:selecting', (element) -> $('#custom-form-column').addClass('hidden') $('#wizard-custom-form .loader').removeClass('hidden') self.wizardCustomFormSelected.push(element.val) @@ -235,7 +242,7 @@ class CIF.ClientAdvanceSearch customFormSelectRemove: -> self = @ - $('.main-report-builder .custom-form-wrapper select').on 'select2-removed', (element) -> + $('.main-report-builder .custom-form-wrapper select').on 'select2:unselect', (element) -> removeValue = element.choice.text formTitle = removeValue.trim() formTitle = self.formatSpecialCharacter("#{formTitle} Custom Form") @@ -246,7 +253,7 @@ class CIF.ClientAdvanceSearch self.handleRemoveFilterBuilder(removeValue, self.CUSTOM_FORM_TRANSLATE) - $('#report-builder-wizard .custom-form-wrapper select').on 'select2-removed', (element) -> + $('#report-builder-wizard .custom-form-wrapper select').on 'select2:unselect', (element) -> removeValue = element.choice.text formTitle = removeValue.trim() formTitle = self.formatSpecialCharacter("#{formTitle} Custom Form") @@ -317,7 +324,7 @@ class CIF.ClientAdvanceSearch handleProgramSelectChange: -> self = @ - $('.main-report-builder select.program-stream-select').on 'select2-selecting', (psElement) -> + $('.main-report-builder select.program-stream-select').on 'select2:selecting', (psElement) -> programId = psElement.val self.programSelected.push programId $('.main-report-builder .program-association').show() @@ -332,7 +339,7 @@ class CIF.ClientAdvanceSearch self.LOADER.start() self.addCustomBuildersFields(programId, self.EXIT_PROGRAM_URL, self.LOADER) - $('#report-builder-wizard select.program-stream-select').on 'select2-selecting', (psElement) -> + $('#report-builder-wizard select.program-stream-select').on 'select2:selecting', (psElement) -> programId = psElement.val self.wizardProgramSelected.push programId $('#report-builder-wizard .program-association').show() @@ -535,21 +542,21 @@ class CIF.ClientAdvanceSearch select2Csi = '#builder_group_0 .rules-list .rule-container .rule-filter-container > select' wizardCsi = '#report-builder-wizard-modal .rules-list .rule-container .rule-filter-container > select' - $(document).on 'select2-open', select2Csi, (e)-> + $(document).on 'select2:open', select2Csi, (e)-> elements = $('.select2-results .select2-results-dept-0') $.each elements, (index, item) -> if item.firstElementChild.textContent == customCsiGroupTranslate $(item).hide() - $(document).on 'select2-open', wizardCsi, (e)-> + $(document).on 'select2:open', wizardCsi, (e)-> elements = $('.select2-results .select2-results-dept-0') $.each elements, (index, item) -> if item.firstElementChild.textContent == customCsiGroupTranslate $(item).hide() - $(document).on 'select2-open', select2Csi, (e)-> + $(document).on 'select2:open', select2Csi, (e)-> selectCsiGroup = '.csi-group .rules-list .rule-container:nth-child(2) .rule-filter-container > select' - $(document).on 'select2-open', selectCsiGroup, (e)-> + $(document).on 'select2:open', selectCsiGroup, (e)-> elements = $('.select2-results .select2-results-dept-0') $.each elements, (index, item) -> if item.firstElementChild.textContent == customCsiGroupTranslate @@ -562,11 +569,11 @@ class CIF.ClientAdvanceSearch wizardFilter = '#report-builder-wizard-modal .rules-list .rule-container .rule-filter-container > select' wizardOperator = '#report-builder-wizard-modal .rules-list .rule-container .rule-operator-container > select' - $(document).on 'select2-selected', wizardFilter, (e)-> + $(document).on 'select2:select', wizardFilter, (e)-> setTimeout (-> $(wizardOperator).select2(width: 'resolve') ), - $(document).on 'select2-open', wizardOperator, (e)-> + $(document).on 'select2:open', wizardOperator, (e)-> elements = $('.select2-results .select2-results-dept-0') $.each elements, (index, item) -> if item.textContent.match(/has.*change|average/g) @@ -581,23 +588,23 @@ class CIF.ClientAdvanceSearch customCsiDomainScoresTranslate = $('#hidden_custom_csi_domain_scores').val() select2Csi = '.csi-group .rules-list .rule-container:nth-child(1) .rule-filter-container > select' - $(document).on 'select2-open', select2Csi, (e)-> + $(document).on 'select2:open', select2Csi, (e)-> elements = $('.select2-results .select2-results-dept-0') handleCsiOption(elements, "#{csiDomainScoresTranslate}-#{customCsiDomainScoresTranslate}") select2Csi = '.csi-group .rules-list .rule-container:nth-child(2) .rule-filter-container > select' - $(document).on 'select2-open', select2Csi, (e)-> + $(document).on 'select2:open', select2Csi, (e)-> elements = $('.select2-results .select2-results-dept-0') handleCsiOption(elements, customCsiGroupTranslate, 'second-child') select2Csi = '.csi-group .rules-list .rule-container:nth-child(3) .rule-filter-container > select' - $(document).on 'select2-open', select2Csi, (e)-> + $(document).on 'select2:open', select2Csi, (e)-> elements = $('.select2-results .select2-results-dept-0') handleCsiOption(elements, customCsiGroupTranslate, 'third-child') handleAllDomainOperatorOpen: -> select2Csi = '.csi-group .rules-list .rule-container:nth-child(1) .rule-operator-container > select' - $(document).on 'select2-open', select2Csi, (e)-> + $(document).on 'select2:open', select2Csi, (e)-> group = window.customGroup[$(@).closest('.csi-group').attr('id')] if $("##{group.id} option[value='all_domains']:selected").length > 0 || $("##{group.id} option[value='all_custom_domains']:selected").length > 0 elements = $('.select2-results .select2-results-dept-0') @@ -642,7 +649,7 @@ class CIF.ClientAdvanceSearch hideAverageFromIndividualDomainScore: -> select2Operator = '.csi-group .rules-list .rule-container:nth-child(1) .rule-operator-container > select' - $(document).on 'select2-open', select2Operator, (e)-> + $(document).on 'select2:open', select2Operator, (e)-> elements = $('.select2-results .select2-results-dept-0') if $(this.parentElement.parentElement).find('.rule-filter-container').find('option[value="all_domains"]:selected').length == 0 and $(this.parentElement.parentElement).find('.rule-filter-container').find('option[value="all_custom_domains"]:selected').length == 0 $.each elements, (index, item) -> @@ -656,7 +663,7 @@ class CIF.ClientAdvanceSearch handleSelect2RemoveProgram: -> self = @ programStreamKeyword = ['Enrollment', 'Tracking', 'Exit Program'] - $('.main-report-builder .program-stream-select').on 'select2-removed', (element) -> + $('.main-report-builder .program-stream-select').on 'select2:unselect', (element) -> programName = element.choice.text self.removeCheckboxColumnPickers(programStreamKeyword, programName, self) @@ -671,7 +678,7 @@ class CIF.ClientAdvanceSearch $(programStreamAssociation).find('.i-checks').iCheck('uncheck') $(programStreamAssociation).hide() - $('#report-builder-wizard .program-stream-select').on 'select2-removed', (element) -> + $('#report-builder-wizard .program-stream-select').on 'select2:unselect', (element) -> programName = element.choice.text self.removeCheckboxColumnPickers(programStreamKeyword, programName, self) @@ -797,6 +804,9 @@ class CIF.ClientAdvanceSearch if btnID == 'search' builderElement = '#builder' builderForm = '.main-report-builder' + if $('#builder').queryBuilder('getSQL', false, true) + sql_sting = $('#builder').queryBuilder('getSQL', false, true).sql + $('#client_advanced_search_raw_sql').val(sql_sting) programValues = if self.programSelected.length > 0 then "[#{self.programSelected}]" customFormValues = if self.customFormSelected.length > 0 then "[#{self.customFormSelected}]" else @@ -807,10 +817,6 @@ class CIF.ClientAdvanceSearch basicRules = $(builderElement).queryBuilder('getRules', { skip_empty: true, allow_invalid: true }) - if $('#builder').queryBuilder('getSQL', false, true) - sql_sting = $('#builder').queryBuilder('getSQL', false, true).sql - $('#raw_sql').val(sql_sting) - self.setValueToProgramAssociation() $('#client_advanced_search_custom_form_selected').val(customFormValues) $('#client_advanced_search_program_selected').val(programValues) @@ -892,7 +898,7 @@ class CIF.ClientAdvanceSearch if obj != undefined rowBuilderRule = obj.$el[0] ruleFiltersSelect = $(rowBuilderRule).find('.rule-filter-container select') - $(ruleFiltersSelect).on 'select2-close', -> + $(ruleFiltersSelect).on 'select2:close', -> ruleParentId = $(@).closest("div[id^='builder_rule']").attr('id') setTimeout ( -> $("##{ruleParentId} .rule-operator-container select, .rule-value-container select").select2(width: 'resolve') @@ -910,7 +916,7 @@ class CIF.ClientAdvanceSearch ###################################################################################################################### filterSelecting: -> - $(document).on 'select2-open', '.rule-value-container input.form-control', (e)-> + $(document).on 'select2:open', '.rule-value-container input.form-control', (e)-> ruleParentElement = $(this.parentElement.parentElement) filterValue = ruleParentElement.find('.rule-filter-container').find('option[value^="domainscore"]:selected') allDomainFilter = ruleParentElement.find('.rule-filter-container').find('option[value="all_domains"]:selected') @@ -931,7 +937,7 @@ class CIF.ClientAdvanceSearch ) disableOptions: -> - $(document).on 'select2-selected', '.rule-operator-container select', (e)-> + $(document).on 'select2:select', '.rule-operator-container select', (e)-> ruleParentElement = $(this.parentElement.parentElement) schoolGradeFilter = ruleParentElement.find('.rule-filter-container').find('option[value="school_grade"]:selected') betweenOperator = ruleParentElement.find('.rule-operator-container').find('option[value="between"]:selected') diff --git a/app/assets/javascripts/clients/index.coffee b/app/assets/javascripts/clients/index.coffee index 89e565f062..73ccec424a 100644 --- a/app/assets/javascripts/clients/index.coffee +++ b/app/assets/javascripts/clients/index.coffee @@ -13,7 +13,7 @@ CIF.ClientsIndex = do -> placement: 'bottom' smartPlacement: true orphan: true - template: "
+ template: "
@@ -530,8 +530,9 @@ CIF.ClientsIndex = do -> _enableSelect2 = -> $('#clients-index select').select2 - minimumInputLength: 0, + minimumInputLength: 0 allowClear: true + dropdownAutoWidth : true _formatReportxAxis = -> Highcharts.setOptions global: useUTC: false @@ -729,12 +730,12 @@ CIF.ClientsIndex = do -> $(document).on 'change', select2CsiOperator, (param)-> filterSelected = $(this).parent().siblings().closest('.rule-filter-container').find('select option:selected').val() - if filterSelected.match(/domainscore_/g) || filterSelected.match(/all_domains/g) + if filterSelected && (filterSelected.match(/domainscore_/g) || filterSelected.match(/all_domains/g)) _addSelectionOption(this, param) $(document).on 'change', wizardCsiFilter, (param)-> filterSelected = $(this).parent().siblings().closest('.rule-filter-container').find('select option:selected').val() - if filterSelected.match(/domainscore_/g) || filterSelected.match(/all_domains/g) + if filterSelected && (filterSelected.match(/domainscore_/g) || filterSelected.match(/all_domains/g)) _addSelectionOption(this, param) _handleDomainScoreFilterValue = -> @@ -742,11 +743,11 @@ CIF.ClientsIndex = do -> wizardCsiFilter = '#report-builder-wizard-modal .rules-list .rule-container .rule-filter-container select' $(document).on 'change', select2CsiFilter, (param)-> - if param.val.match(/domainscore_/g) || param.val.match(/all_domains/g) + if param.val && (param.val.match(/domainscore_/g) || param.val.match(/all_domains/g)) _addSelectionOption(this, param) $(document).on 'change', wizardCsiFilter, (param)-> - if param.val.match(/domainscore_/g) || param.val.match(/all_domains/g) + if param.val && (param.val.match(/domainscore_/g) || param.val.match(/all_domains/g)) _addSelectionOption(this, param) _reloadFilter = -> diff --git a/app/assets/javascripts/clients/show.coffee b/app/assets/javascripts/clients/show.coffee index 7726f079e3..c9f6459cf4 100644 --- a/app/assets/javascripts/clients/show.coffee +++ b/app/assets/javascripts/clients/show.coffee @@ -123,7 +123,7 @@ CIF.ClientsShow = do -> if element.dataset.classname == "leave_programs" leaveProgramDates.push(new Date (date)) maxLeaveDate = Math.max.apply(Math, leaveProgramDates) - date = new Date(maxLeaveDate) + date = if typeof(maxLeaveDate) == 'number' then (new Date()) else new Date(maxLeaveDate) $(".exit_date").datepicker('setStartDate', date) _initSelect2 = -> diff --git a/app/assets/javascripts/common.coffee b/app/assets/javascripts/common.coffee index 26dff57ccb..c120a4bda0 100644 --- a/app/assets/javascripts/common.coffee +++ b/app/assets/javascripts/common.coffee @@ -1,5 +1,6 @@ CIF.Common = init: -> + @queryBuilderSelect2PluginInit() @hideDynamicOperator() @validateFilterNumber() @customCheckBox() @@ -10,6 +11,47 @@ CIF.Common = @checkValidationErrorExistOnSaving() @preventEditOnDatePicker() @confirmOnCancelBotton() + $.fn.select2.defaults.set( "theme", "bootstrap" ) + + queryBuilderSelect2PluginInit: -> + $.fn.queryBuilder.define 'select2', ((options) -> + if !$.fn.select2 or !$.fn.select2.constructor + Utils.error 'MissingLibrary', 'Select2 is required' + Selectors = $(".rule-operator-container [name$=_operator], .rule-filter-container [name$=_filter]") + if Selectors + @on 'afterCreateRuleFilters', (e, rule) -> + selectInput = rule.$el.find(".rule-filter-container select[name$=_filter]") + selectInput.parent().css('minWidth', '250px') + selectInput.select2 options + return + @on 'afterCreateRuleOperators', (e, rule) -> + selectInput = rule.$el.find(".rule-operator-container select[name$=_operator]") + selectInput.parent().css('minWidth', '150px') + selectInput.select2 options + return + @on 'afterUpdateRuleFilter', (e, rule) -> + rule.$el.find(".rule-filter-container [name$=_filter]").select2 options + selectInput = rule.$el.find(".rule-value-container select[name*=_value_]") + selectInput.parent().css('minWidth', '250px') + selectInput.select2 options + return + @on 'afterUpdateRuleOperator', (e, rule) -> + rule.$el.find(".rule-operator-container [name$=_operator]").select2 options + selectInput = rule.$el.find(".rule-value-container select[name*=_value_]") + selectInput.parent().css('minWidth', '250px') + selectInput.select2(dropdownAutoWidth: true) + return + @on 'beforeDeleteRule', (e, rule) -> + rule.$el.find(".rule-filter-container select[name$=_filter]").select2 'destroy' + rule.$el.find(".rule-operator-container select[name$=_operator]").select2 'destroy' + return + return + ), + container: 'body' + style: 'btn-inverse btn-xs' + width: '250px' + dropdownAutoWidth: true + showIcon: false preventEditOnDatePicker: -> $('.date-picker').datepicker diff --git a/app/assets/javascripts/dashboards/index.coffee b/app/assets/javascripts/dashboards/index.coffee index e990ce64e8..2583df05fd 100644 --- a/app/assets/javascripts/dashboards/index.coffee +++ b/app/assets/javascripts/dashboards/index.coffee @@ -1,12 +1,4 @@ CIF.DashboardsIndex = do -> - @window.getService = (td, select_id)-> - data = {id: td.children[0].value, text: td.children[0].text } - - newOption = new Option(data.text, data.id, true, true) - - # Append it to the select - $(".type-of-service select##{select_id.id}").append(newOption).trigger 'change' - _init = -> # _clientGenderChart() # _clientStatusChart() @@ -21,7 +13,8 @@ CIF.DashboardsIndex = do -> _initTrackingDatatable() _handleMultiForm() _handleProgramStreamServiceShow() - _handleProgramStreamServiceSelect2() + service_types = new CIF.ServiceTypes({ element: '.type-of-service', isFromDashboard: true }) + service_types.selectServiceTypeTableResult() _updateProgramStream() _enableSaveReferralSource() _clickSaveReferral() @@ -36,13 +29,13 @@ CIF.DashboardsIndex = do -> localStorage.setItem('from login', false) _enableSaveReferralSource = -> - $('.referral_source_ancestry .select').on 'select2-selected', (e) -> - classNames = this.className.split(' ') - saveBtnClass = ".save-" + classNames[2] + $('.referral_source_ancestry .select').on 'select2:select', (e) -> + referralId = this.id.match(/\d+/)[0] + saveBtnClass = ".save-" + referralId $(saveBtnClass).removeAttr 'disabled' - $('.referral_source_ancestry .select').on 'select2-removed', (e) -> - classNames = this.className.split(' ') - saveBtnClass = ".save-" + classNames[2] + $('.referral_source_ancestry .select').on 'select2:unselect', (e) -> + referralId = this.id.match(/\d+/)[0] + saveBtnClass = ".save-" + referralId $(saveBtnClass).attr('disabled', 'disabled') _clickSaveReferral = -> @@ -75,6 +68,7 @@ CIF.DashboardsIndex = do -> _initSelect2 = -> $('select').select2 + placeholder: "---Please select an option---", minimumInputLength: 0 allowClear: true @@ -165,76 +159,6 @@ CIF.DashboardsIndex = do -> $('.modal.in').removeClass('modal-popup') return - - _handleProgramStreamServiceSelect2 = -> - $('.type-of-service select').select2 - width: '100%' - - createHeaderElement = (options, indexes)-> - html = "" - indexes.forEach (entry) -> - html += "#{options[entry][0]}" - html - - createRowElement = (options, indexes, select_id) -> - html = "" - indexes.forEach (entries) -> - td = "" - entries.forEach (index) -> - td += "" - - html += "#{td}" - html - - $('.type-of-service select').on 'select2-open', (e) -> - $('#select2-drop').addClass('drop') - arr = [] - i = 0 - while i < $('.type-of-service').data('custom').length - arr.push i - i++ - - options = $('.type-of-service').data('custom') - results = [] - chunk_size = 13 - while arr.length > 0 - results.push arr.splice(0, chunk_size) - - indexes = results.shift() - th = createHeaderElement(options, indexes) - row = createRowElement(options, results, @id) - - html = '' + th + '' + row + '
' - $('#select2-drop .select2-results').html $(html) - # $('.select2-results').prepend "#{html}" - return - - removeError = (element) -> - element.removeClass('has-error') - element.find('.help-block').remove() - - $('.type-of-service select').on 'select2-close', (e)-> - uniqueArray = _.compact(_.uniq($(this).val())) - if uniqueArray.length > 0 - removeError($(this.parentElement)) - arrId = this.id.split('_') - $("#edit_program_stream_#{arrId[arrId.length - 1]} input[type='submit']").removeAttr('disabled') - - if uniqueArray.length > 3 - $(this.parentElement).append "

#{$('input#confirm-question').val()}

" if $(this.parentElement).find('.help-block').length == 0 - $(this.parentElement).addClass('has-error') - - return - - $('.type-of-service select').on 'select2-removed', -> - uniqueArray = _.compact(_.uniq($(this).val())) - if uniqueArray.length <= 3 - removeError($(this.parentElement)) - - if uniqueArray.length == 0 - arrId = this.id.split('_') - $("#edit_program_stream_#{arrId[arrId.length - 1]} input[type='submit']").attr('disabled', 'disabled') - _updateProgramStream = -> $('form.simple_form.program-stream').on 'submit', (e)-> e.preventDefault @@ -246,8 +170,8 @@ CIF.DashboardsIndex = do -> data: $(this).serialize() dataType: 'JSON' success: (json) -> - successImg = $("#edit_program_stream_#{json.program_stream.id} .save-success-#{json.program_stream.id}").removeClass('hide') - $("#edit_program_stream_#{json.program_stream.id} input[type='submit']").replaceWith(successImg) + successImg = $("#edit_program_stream_#{json.id || json.program_stream.id} .save-success-#{json.id || json.program_stream.id}").removeClass('hide') + $("#edit_program_stream_#{json.id || json.program_stream.id} input[type='submit']").replaceWith(successImg) return error: (response, status, msg) -> $("form[action='#{@url}'] .program_stream_services").append "

Failed to update program stream.

" if $(this.parentElement).find('.help-block').length == 0 @@ -263,46 +187,45 @@ CIF.DashboardsIndex = do -> searchingClient = $("#searching_format-input").val() notFoundClient = $("#not_found_format-input").val() enterCharacters = $("#please_enter_more_char_format-input").val() + + formatClient = (client) -> + if client.loading + return client.text + en_full_name = "#{client.given_name} #{client.family_name}" + local_full_name = "#{client.local_given_name} #{client.local_family_name}" + markup = "#{en_full_name} | #{local_full_name} (#{client.id})" + + $container = $("
") + $container.find('.select2-result-client__full_name').append markup + $container.find('.select2-result-client__slug').text client.slug + $container.find('.select2-result-client_status').append "Status: #{client.status}" + $container + + formatClientSelection = (client) -> + if !client.slug + return client.text + + win = window.open("clients/#{client.slug}", '_blank') + $('#search-client-select2').select2( - placeholder: searchForClient - minimumInputLength: 1 - formatSearching: searchingClient - formatNoMatches: notFoundClient - formatInputTooShort: enterCharacters + language: "km" ajax: - url: '/api/clients/search_client' - dataType: 'json' - quietMillis: 250 - data: (term, page) -> - { q: term } - results: (data, page) -> + url: "/api/clients/search_client" + dataType: "json" + delay: 250 + data: (params) -> + { q: params.term } + processResults: (data, params) -> { results: data } cache: true - initSelection: (element, callback) -> - id = $(element).select2('data', null).trigger("change") - return - formatResult: (client) -> - en_full_name = "#{client.given_name} #{client.family_name}" - local_full_name = "#{client.local_given_name} #{client.local_family_name}" - markup = "#{en_full_name} | #{local_full_name} (#{client.id})" - - return markup - formatSelection: (client) -> - win = window.open("clients/#{client.slug}", '_blank') - $('#search-client-select2').trigger("change") - ).on 'select2-blur select2-focus', -> - $(@).trigger("change") - return - - $(window).focus(-> - $('#search-client-select2').trigger("change") - return - ).blur -> - $('#s2id_search-client-select2 .select2-chosen').attr('style', 'color: #999999').text(searchForClient) if $('#s2id_search-client-select2 .select2-chosen').val().length == 0 - return + placeholder: searchForClient + minimumInputLength: 1 + templateResult: formatClient + templateSelection: formatClientSelection + ) _handleMultiFormAssessmentCaseNote = -> - $('#client-select-assessment').on('select2-selected', (e) -> + $('#client-select-assessment').on('select2:select', (e) -> $("ul#assessment-tab-dropdown a").removeClass('disabled') idClient = e.val if $('#csi-assessment-link').length @@ -316,11 +239,11 @@ CIF.DashboardsIndex = do -> $("#assessment-tab-dropdown").removeClass('disabled') $(this).val('') - ).on 'select2-removed', () -> + ).on 'select2:unselect', () -> $("ul#assessment-tab-dropdown a").attr('href', "javascript:void(0)") $("ul#assessment-tab-dropdown a").addClass('disabled') - $('#client-select-case-note').on('select2-selected', (e) -> + $('#client-select-case-note').on('select2:select', (e) -> $("ul#casenote-tab-dropdown a").removeClass('disabled') idClient = e.val if $('#csi-case-note-link').length @@ -332,7 +255,7 @@ CIF.DashboardsIndex = do -> url = $(element).attr('href').replace(/\/\//, "/#{idClient}/") $(element).attr('href', url) $(this).val('') - ).on 'select2-removed', () -> + ).on 'select2:unselect', () -> $("ul#casenote-tab-dropdown a").attr('href', "javascript:void(0)") $("ul#casenote-tab-dropdown a").addClass('disabled') diff --git a/app/assets/javascripts/program_streams/form.coffee b/app/assets/javascripts/program_streams/form.coffee index 5889c57113..1481dd94bb 100644 --- a/app/assets/javascripts/program_streams/form.coffee +++ b/app/assets/javascripts/program_streams/form.coffee @@ -6,12 +6,6 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C TRACKING = '' DATA_TABLE_ID = '' @formBuilder = [] - @window.getServiceData = (td)-> - data = {id: td.children[0].value, text: td.children[0].text } - - newOption = new Option(data.text, data.id, true, true) - # Append it to the select - $('#type-of-service select').append(newOption).trigger 'change' _init = -> @filterTranslation = '' @@ -38,7 +32,8 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C _custom_field_list() _initDataTable() _filterSelecting() - _selectServiceTypeTableResult() + service_types = new CIF.ServiceTypes({ element: '#type-of-service', isFromDashboard: false }) + service_types.selectServiceTypeTableResult() _initDataTable = -> $('.custom-field-table').each -> @@ -121,10 +116,10 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C for value in $(programExclusive).val() $(mutualDependence).find("option[value=#{value}]").attr('disabled', true) - $(programExclusive).on 'select2-selecting', (select)-> + $(programExclusive).on 'select2:selecting', (select)-> $(mutualDependence).find("option[value=#{select.val}]").attr('disabled', true) - $(programExclusive).on 'select2-removed', (select)-> + $(programExclusive).on 'select2:unselect', (select)-> $(mutualDependence).find("option[value=#{select.val}]").removeAttr('disabled') _selectOptonMutualDependence = (programExclusive, mutualDependence) -> @@ -132,10 +127,10 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C for value in mutualDependence.val() $(programExclusive).find("option[value=#{value}]").attr('disabled', true) - $(mutualDependence).on 'select2-selecting', (select)-> + $(mutualDependence).on 'select2:selecting', (select)-> $(programExclusive).find("option[value=#{select.val}]").attr('disabled', true) - $(mutualDependence).on 'select2-removed', (select)-> + $(mutualDependence).on 'select2:unselect', (select)-> $(programExclusive).find("option[value=#{select.val}]").removeAttr('disabled') _handleSelectTab = -> @@ -207,7 +202,7 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C save: $('.program-steps').data('save') _handleSelectOptionChange = -> - $('select').on 'select2-selecting', (e) -> + $('select').on 'select2:selecting', (e) -> setTimeout (-> $('.rule-operator-container select, .rule-value-container select').select2( width: '180px' @@ -219,7 +214,7 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C url: '/api/program_stream_add_rule/get_fields' method: 'GET' success: (response) -> - fieldList = response.program_stream_add_rule + fieldList = if !response.program_stream_add_rule then response else response.program_stream_add_rule builder = new CIF.AdvancedFilterBuilder($('#program-rule'), fieldList, filterTranslation) builder.initRule() setTimeout (-> @@ -497,7 +492,7 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C for labelField in labelFields text = labelField.textContent.allReplace(specialCharacters) - if fields.includes(text) + if fields && fields.includes(text) _removeActionFormBuilder(labelField, elementId) _hideActionInTracking = (fields) -> @@ -540,7 +535,7 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C for labelField in labelFields text = labelField.textContent.allReplace(specialCharacters) - if fields.includes(text) + if fields && fields.includes(text) _removeActionFormBuilderProgramStream(labelField) _hideActionInTrackingProgramStream = (fields) -> @@ -679,7 +674,7 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C _handleRemoveFrequency = -> frequencies = $('.program_stream_trackings_frequency select') - $(frequencies).on 'select2-removed', (element) -> + $(frequencies).on 'select2:unselect', (element) -> select = element.currentTarget nestedField = $(select).parents('.nested-fields') timeOfFrequency = $(nestedField).find('.program_stream_trackings_time_of_frequency input') @@ -689,7 +684,7 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C _handleSelectFrequency = -> frequencies = $('.program_stream_trackings_frequency select') - $(frequencies).on 'select2-selecting', (element) -> + $(frequencies).on 'select2:selecting', (element) -> select = element.currentTarget frequencyNote = select.parentElement.nextElementSibling frequencyValue = _convertFrequency(element.val) @@ -753,14 +748,14 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C _disableOptions(element) _filterSelecting = -> - $('.rule-filter-container select').on 'select2-selecting', -> + $('.rule-filter-container select').on 'select2:selecting', -> self = @ setTimeout ( -> _opertatorSelecting() ) _opertatorSelecting = -> - $('.rule-operator-container select').on 'select2-selected', -> + $('.rule-operator-container select').on 'select2:select', -> _disableOptions(@) _setDefaultBetweenSchoolGrade(@) @@ -805,78 +800,5 @@ CIF.Program_streamsNew = CIF.Program_streamsEdit = CIF.Program_streamsCreate = C $(select).find('select').val('1').trigger('change') , 100) - _selectServiceTypeTableResult = () -> - if $('li').hasClass('first current') - # $('#type-of-service select').select2() - - format = (state) -> - if !state.id - return state.text - - serviceFormatSelection = (service) -> - service.text - - $('#type-of-service select').select2 - width: '100%' - formatSelection: serviceFormatSelection - escapeMarkup: (m) -> - m - - createHeaderElement = (options, indexes)-> - html = "" - indexes.forEach (entry) -> - html += "#{options[entry][0]}" - html - - createRowElement = (options, indexes) -> - html = "" - indexes.forEach (entries) -> - td = "" - entries.forEach (index) -> - td += "" - - html += "#{td}" - html - - $('#type-of-service select').on 'select2-open', (e) -> - arr = [] - i = 0 - while i < $('#type-of-service').data('custom').length - arr.push i - i++ - - options = $('#type-of-service').data('custom') - results = [] - chunk_size = 13 - while arr.length > 0 - results.push arr.splice(0, chunk_size) - - indexes = results.shift() - th = createHeaderElement(options, indexes) - row = createRowElement(options, results) - - html = '' + th + '' + row + '
' - $('#select2-drop .select2-results').html $(html) - # $('.select2-results').prepend "#{html}" - return - - removeError = (element) -> - element.removeClass('has-error') - element.find('.help-block').remove() - - $('#type-of-service select').on 'select2-close', (e)-> - uniqueArray = _.compact(_.uniq($(this).val())) - - if uniqueArray.length > 3 - $(this.parentElement).append "

#{$('input#confirm-question').val()}

" if $(this.parentElement).find('.help-block').length == 0 - $(this.parentElement).addClass('has-error') - - return - - $('#type-of-service select').on 'select2-removed', -> - uniqueArray = _.compact(_.uniq($(this).val())) - if uniqueArray.length <= 3 - removeError($(this.parentElement)) - { init: _init } diff --git a/app/assets/javascripts/referral_sources/index.coffee b/app/assets/javascripts/referral_sources/index.coffee index 3ee9d5b890..7bc09b7a22 100644 --- a/app/assets/javascripts/referral_sources/index.coffee +++ b/app/assets/javascripts/referral_sources/index.coffee @@ -6,7 +6,7 @@ CIF.Referral_sourcesIndex = do -> _initSelect2 = -> $('select').select2() - + _newReferralSourceValidation = -> data = { name: '#new_referral_source #referral_source_name', @@ -36,7 +36,7 @@ CIF.Referral_sourcesIndex = do -> _modalButtonAction(form, btn, name, category) $(name).add(category).bind 'keyup change', -> _modalButtonAction(form, btn, name, category) - $('select').on 'select2-selected', -> + $('select').on 'select2:select', -> _modalButtonAction(form, btn, name, category) _modalButtonAction = (form, btn, name, category) -> @@ -46,7 +46,7 @@ CIF.Referral_sourcesIndex = do -> $(form).find(btn).attr 'disabled', 'disabled' else $(form).find(btn).removeAttr 'disabled' - - + + { init: _init } diff --git a/app/assets/javascripts/referrals/form.coffee b/app/assets/javascripts/referrals/form.coffee index 8c9fab329f..a07538b111 100644 --- a/app/assets/javascripts/referrals/form.coffee +++ b/app/assets/javascripts/referrals/form.coffee @@ -1,24 +1,18 @@ CIF.ReferralsNew = CIF.ReferralsCreate = CIF.ReferralsUpdate = CIF.ReferralsEdit = do -> - @window.getServiceData = (td)-> - data = {id: td.children[0].value, text: td.children[0].text } - - newOption = new Option(data.text, data.id, true, true) - # Append it to the select - $('#type-of-service select').append(newOption).trigger 'change' - _init = -> _initSelect2() _initExternalReferral() _handleExternalReferralSelected() _initUploader() - _selectServiceTypeTableResult() + service_types = new CIF.ServiceTypes({ element: '#type-of-service', isFromDashboard: false }) + service_types.selectServiceTypeTableResult() _handleExternalReferralSelected = -> $('.referral_referred_to').on 'change', -> _initExternalReferral() _initSelect2 = -> - $('select').select2() + $('select#referral_referred_to').select2() _initExternalReferral = -> referredTo = document.getElementById('referral_referred_to') @@ -35,74 +29,4 @@ CIF.ReferralsNew = CIF.ReferralsCreate = CIF.ReferralsUpdate = CIF.ReferralsEdit theme: "explorer" allowedFileExtensions: ['jpg', 'png', 'jpeg', 'doc', 'docx', 'xls', 'xlsx', 'pdf'] - _selectServiceTypeTableResult = () -> - format = (state) -> - if !state.id - return state.text - - serviceFormatSelection = (service) -> - service.text - - $('#type-of-service select').select2 - width: '100%' - formatSelection: serviceFormatSelection - escapeMarkup: (m) -> - m - - createHeaderElement = (options, indexes)-> - html = "" - indexes.forEach (entry) -> - html += "#{options[entry][0]}" - html - - createRowElement = (options, indexes) -> - html = "" - indexes.forEach (entries) -> - td = "" - entries.forEach (index) -> - td += "" - - html += "#{td}" - html - - $('#type-of-service select').on 'select2-open', (e) -> - arr = [] - i = 0 - while i < $('#type-of-service').data('custom').length - arr.push i - i++ - - options = $('#type-of-service').data('custom') - results = [] - chunk_size = 13 - while arr.length > 0 - results.push arr.splice(0, chunk_size) - - indexes = results.shift() - th = createHeaderElement(options, indexes) - row = createRowElement(options, results) - - html = '' + th + '' + row + '
' - $('#select2-drop .select2-results').html $(html) - # $('.select2-results').prepend "#{html}" - return - - removeError = (element) -> - element.removeClass('has-error') - element.find('.help-block').remove() - - $('#type-of-service select').on 'select2-close', (e)-> - uniqueArray = _.compact(_.uniq($(this).val())) - - if uniqueArray.length > 3 - $(this.parentElement).append "

#{$('input#confirm-question').val()}

" if $(this.parentElement).find('.help-block').length == 0 - $(this.parentElement).addClass('has-error') - - return - - $('#type-of-service select').on 'select2-removed', -> - uniqueArray = _.compact(_.uniq($(this).val())) - if uniqueArray.length <= 3 - removeError($(this.parentElement)) - { init: _init } diff --git a/app/assets/javascripts/service_types.coffee b/app/assets/javascripts/service_types.coffee new file mode 100644 index 0000000000..2ea3ea3dd6 --- /dev/null +++ b/app/assets/javascripts/service_types.coffee @@ -0,0 +1,102 @@ +class CIF.ServiceTypes + constructor: (args)-> + @isFromDashboard = args['isFromDashboard'] + @element = args['element'] + window.getServiceData = (td = undefined, select_id = null) -> + if td == undefined + return + + data = { id: td.children[0].value, text: td.children[0].text } + # Append it to the select + typeOfServiceSelect = if select_id == null then $('#type-of-service select') else $(".type-of-service select##{select_id && select_id.id}") + # Set the value, creating a new option if necessary + if typeOfServiceSelect.select2().val() == null + typeOfServiceSelect.val(data.id) + else + typeOfServiceSelect.val(_.uniq(_.concat(typeOfServiceSelect.select2().val(), data.id))) + + typeOfServiceSelect.trigger('change') + + selectServiceTypeTableResult: -> + isFromDashboard = @isFromDashboard + element = @element + if $('li').hasClass('first current') or $('#program-stream-service').length or $('.referral_services').length + # $('#type-of-service select').select2() + + format = (state) -> + if !state.id + return state.text + + serviceFormatSelection = (service) -> + service.text + + $("#{element} select").select2 + width: '100%' + templateSelection: serviceFormatSelection + escapeMarkup: (m) -> + m + + createHeaderElement = (options, indexes)-> + html = "" + indexes.forEach (entry) -> + html += "#{options[entry][0]}" + html + + createRowElement = (options, indexes, select_id=null) -> + html = "" + indexes.forEach (entries) -> + td = "" + entries.forEach (index) -> + td += "" + + html += "#{td}" + html + + $("#{element} select").on 'select2:open', (e) -> + arr = [] + i = 0 + while i < $(element).data('custom').length + arr.push i + i++ + + options = $(element).data('custom') + results = [] + chunk_size = 13 + while arr.length > 0 + results.push arr.splice(0, chunk_size) + + indexes = results.shift() + th = createHeaderElement(options, indexes) + elementId = if isFromDashboard then @id else null + row = createRowElement(options, results, elementId) + + html = '' + th + '' + row + '
' + $('.select2-dropdown .select2-results').html $(html) + # $('.select2-results').prepend "#{html}" + return + + removeError = (element) -> + element.removeClass('has-error') + element.find('.help-block').remove() + + $("#{element} select").on 'select2:close', (e)-> + uniqueArray = _.compact(_.uniq($(this).val())) + if uniqueArray.length > 3 + $(this.parentElement).append "

#{$('input#confirm-question').val()}

" if $(this.parentElement).find('.help-block').length == 0 + $(this.parentElement).addClass('has-error') + + if uniqueArray.length > 0 + removeError($(this.parentElement)) + arrId = this.id.split('_') + $("#edit_program_stream_#{arrId[arrId.length - 1]} input[type='submit']").removeAttr('disabled') + + return + + $("#{element} select").on 'select2:unselect', -> + uniqueArray = _.compact(_.uniq($(this).val())) + if uniqueArray.length <= 3 + removeError($(this.parentElement)) + + if uniqueArray.length == 0 + arrId = this.id.split('_') + $("#edit_program_stream_#{arrId[arrId.length - 1]} input[type='submit']").attr('disabled', 'disabled') diff --git a/app/assets/javascripts/users/form.coffee b/app/assets/javascripts/users/form.coffee index d57843347b..2b77c1172d 100644 --- a/app/assets/javascripts/users/form.coffee +++ b/app/assets/javascripts/users/form.coffee @@ -11,7 +11,7 @@ CIF.UsersNew = CIF.UsersCreate = CIF.UsersEdit = CIF.UsersUpdate = CIF.Registrat radioClass: 'iradio_square-green' _initSelect2 = -> - $('select').select2({ allowClear: true }, _clearSelectedOption()).on('select2-removing', (e) -> + $('select').select2({ allowClear: true }, _clearSelectedOption()).on('select2:unselecting', (e) -> shouldRemove = true if $(@).attr('multiple').length > 0 and ($('body').attr('id') == 'users-update' or $('body').attr('id') == 'users-edit') path = "/api/clients/#{e.val}/find_client_case_worker?user_id=#{$('#user_id').val()}" @@ -30,7 +30,7 @@ CIF.UsersNew = CIF.UsersCreate = CIF.UsersEdit = CIF.UsersUpdate = CIF.Registrat $('.select.optional.user_clients').append("#{$('#warning_message').val()}") return shouldRemove - ).on 'select2-selecting', (e) -> + ).on 'select2:selecting', (e) -> if $(@).attr('id').length > 0 and e.val != 'strategic overviewer' $('#clients-selection:hidden').removeClass('hide') else diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 49e2865a95..1c70260afc 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,92 +1,92 @@ // Framework -@import 'font-awesome'; -@import 'step'; -@import 'thredded'; -@import 'select2'; -@import 'select2-bootstrap'; -@import 'bootstrap-datepicker'; -@import 'dropzone/dropzone'; -@import 'formBuilder/form-builder.min'; -@import 'formBuilder/form-render.min'; +@import "font-awesome"; +@import "step"; +@import "thredded"; +@import "select2"; +@import "select2-bootstrap"; +@import "bootstrap-datepicker"; +@import "dropzone/dropzone"; +@import "formBuilder/form-builder.min"; +@import "formBuilder/form-render.min"; @import "bourbon"; @import "neat"; @import "fullcalendar"; -@import 'animate/animate'; -@import 'iCheck/custom'; -@import 'iCheck/brown'; -@import 'iCheck/red'; -@import 'iCheck/orange'; -@import 'toastr/toastr.min'; -@import 'wrapbootstrap/style'; -@import 'footable/footable.core'; -@import 'bootstrap_file_input/file_input.min'; -@import 'bootstrap_file_input/explorer/theme.min'; +@import "animate/animate"; +@import "iCheck/custom"; +@import "iCheck/brown"; +@import "iCheck/red"; +@import "iCheck/orange"; +@import "toastr/toastr.min"; +@import "wrapbootstrap/style"; +@import "footable/footable.core"; +@import "bootstrap_file_input/file_input.min"; +@import "bootstrap_file_input/explorer/theme.min"; // @import 'query_builder/query-builder.default'; @import "query-builder.default"; -@import 'dataTables/bootstrap/3/jquery.dataTables.bootstrap'; -@import 'dataTables/buttons.dataTables.min'; -@import 'bootstrap-tour/bootstrap-tour.css'; -@import 'ladda/ladda.min'; -@import 'ladda/ladda-themeless.min'; +@import "dataTables/bootstrap/3/jquery.dataTables.bootstrap"; +@import "dataTables/buttons.dataTables.min"; +@import "bootstrap-tour/bootstrap-tour.css"; +@import "ladda/ladda.min"; +@import "ladda/ladda-themeless.min"; @import "editable/bootstrap-editable"; // Components -@import 'case/quarterly_reports/*'; -@import 'sessions/*'; -@import 'cases/*'; -@import 'calendars/*'; -@import 'client/task/*'; -@import 'client/custom_fields/*'; -@import 'family/custom_fields/*'; -@import 'partner/custom_fields/*'; -@import 'user/custom_fields/*'; -@import 'clients/*'; -@import 'client_books/index'; -@import 'families/*'; -@import 'users/*'; -@import 'partners/*'; -@import 'common_index'; -@import 'assessments/*'; -@import 'tasks/*'; -@import 'case_notes/*'; -@import 'agencies/*'; -@import 'referral_sources/*'; -@import 'domain_groups/*'; -@import 'domains/*'; -@import 'provinces/*'; -@import 'departments/*'; -@import 'form'; -@import 'quantitative_types/*'; -@import 'home/*'; -@import 'unsupported_browser'; -@import 'changelogs/*'; -@import 'data_trackers/*'; -@import 'materials/*'; -@import 'locations/*'; -@import 'notifications/*'; -@import 'progress_note_types/*'; -@import 'interventions/*'; -@import 'progress_notes/*'; -@import 'organizations/*'; -@import 'donors/*'; -@import 'client_advanced_searches/*'; -@import 'program_streams/*'; -@import 'top_navbar'; -@import 'common_version'; -@import 'custom_fields/*'; -@import 'custom_field_properties/*'; -@import 'client_enrollments/*'; -@import 'client_enrollment_trackings/*'; -@import 'leave_programs/*'; -@import 'trackings/*'; -@import 'client_program_stream'; -@import 'dashboards/*'; -@import 'organization_types/*'; -@import 'referrals/*'; -@import 'settings/*'; -@import 'government_forms/*'; -@import 'calls/*'; -@import 'referees/index'; +@import "case/quarterly_reports/*"; +@import "sessions/*"; +@import "cases/*"; +@import "calendars/*"; +@import "client/task/*"; +@import "client/custom_fields/*"; +@import "family/custom_fields/*"; +@import "partner/custom_fields/*"; +@import "user/custom_fields/*"; +@import "clients/*"; +@import "client_books/index"; +@import "families/*"; +@import "users/*"; +@import "partners/*"; +@import "common_index"; +@import "assessments/*"; +@import "tasks/*"; +@import "case_notes/*"; +@import "agencies/*"; +@import "referral_sources/*"; +@import "domain_groups/*"; +@import "domains/*"; +@import "provinces/*"; +@import "departments/*"; +@import "form"; +@import "quantitative_types/*"; +@import "home/*"; +@import "unsupported_browser"; +@import "changelogs/*"; +@import "data_trackers/*"; +@import "materials/*"; +@import "locations/*"; +@import "notifications/*"; +@import "progress_note_types/*"; +@import "interventions/*"; +@import "progress_notes/*"; +@import "organizations/*"; +@import "donors/*"; +@import "client_advanced_searches/*"; +@import "program_streams/*"; +@import "top_navbar"; +@import "common_version"; +@import "custom_fields/*"; +@import "custom_field_properties/*"; +@import "client_enrollments/*"; +@import "client_enrollment_trackings/*"; +@import "leave_programs/*"; +@import "trackings/*"; +@import "client_program_stream"; +@import "dashboards/*"; +@import "organization_types/*"; +@import "referrals/*"; +@import "settings/*"; +@import "government_forms/*"; +@import "calls/*"; +@import "referees/index"; // @import 'css-loader.css'; diff --git a/app/assets/stylesheets/clients/index.scss b/app/assets/stylesheets/clients/index.scss index 4f7082bbed..3f12beff13 100644 --- a/app/assets/stylesheets/clients/index.scss +++ b/app/assets/stylesheets/clients/index.scss @@ -1,6 +1,6 @@ -body[id='clients-index'] { - @import 'iCheck/custom'; - @import 'clients/client_grid'; +body[id="clients-index"] { + @import "iCheck/custom"; + @import "clients/client_grid"; .pagination > { .active > form { @@ -46,12 +46,13 @@ body[id='clients-index'] { th.date { min-width: 100px; } - th.action, th.load-query { + th.action, + th.load-query { min-width: 70px; } } - #prevent_load_saved_searches{ + #prevent_load_saved_searches { width: 50%; } @@ -69,11 +70,11 @@ body[id='clients-index'] { margin-top: 15px; } - .highcharts-legend-item path{ + .highcharts-legend-item path { cursor: pointer; } - #client-statistic-body{ + #client-statistic-body { display: none; margin-bottom: 0; } @@ -82,23 +83,23 @@ body[id='clients-index'] { margin-bottom: 16px; } - .datagrid-filter label{ + .datagrid-filter label { vertical-align: top; padding-top: 5px; } .domain-filter { margin: 10px 0; } - #client-search-domain{ + #client-search-domain { margin-bottom: 20px; } - .select2-container.dynamic_filter{ + .select2-container.dynamic_filter { width: 30%; float: left; margin-right: 5px; } - .dynamic_filter.value{ + .dynamic_filter.value { width: 32%; float: left; } @@ -119,7 +120,7 @@ body[id='clients-index'] { margin-top: 4px; } - @media screen and (max-width: 700px){ + @media screen and (max-width: 700px) { .client-option { a { display: inline-block; @@ -151,10 +152,10 @@ body[id='clients-index'] { } .btn-group.group-actions { - button[data-add='rule'] { + button[data-add="rule"] { background-color: #1ab394; border-color: #1ab394; - color: #FFFFFF; + color: #ffffff; } button { margin-right: 5px; @@ -175,7 +176,8 @@ body[id='clients-index'] { .rule-value-container { border-left: none; - select, input { + select, + input { width: 180px; } input.form-control { @@ -188,20 +190,29 @@ body[id='clients-index'] { float: right; } - .basic-filter-error, .custom-form-error { + .basic-filter-error, + .custom-form-error { color: red; display: none; } - .client-column-picker, .custom-form, .program-stream, .selected-custom-form, .program-association, #wizard-referral-data, #wizard-program-stream, #wizard-custom-form { + .client-column-picker, + .custom-form, + .program-stream, + .selected-custom-form, + .program-association, + #wizard-referral-data, + #wizard-program-stream, + #wizard-custom-form { display: none; } - .program-association{ + .program-association { margin-left: 16px; } - th.form-builder, td.form-builder { + th.form-builder, + td.form-builder { min-width: 480px; } @@ -218,14 +229,19 @@ body[id='clients-index'] { cursor: default; } - .csi-header, .referee-header, .carer-header, .type-of-service-header, .hotline-call-header { + .csi-header, + .referee-header, + .carer-header, + .type-of-service-header, + .hotline-call-header { padding: 5px 16px; strong { font-size: 13px; } } - th.domain-scores, td.domain-scores { + th.domain-scores, + td.domain-scores { min-width: 200px; } @@ -266,7 +282,8 @@ body[id='clients-index'] { right: 5px; top: 10px; color: #337ab7; - &:hover, &:focus { + &:hover, + &:focus { color: #23527c; } input[type="submit"] { @@ -281,11 +298,11 @@ body[id='clients-index'] { } } - .popover[class*="tour-"].orphan .arrow{ + .popover[class*="tour-"].orphan .arrow { display: inline-block; } - .tour-tour{ + .tour-tour { left: 0px !important; // top: 420px !important; width: 227px; @@ -295,7 +312,11 @@ body[id='clients-index'] { } .csi-group { - .btn-add-rule, .rule-actions, .drag-handle, .btn-custom-group, .btn-default-group { + .btn-add-rule, + .rule-actions, + .drag-handle, + .btn-custom-group, + .btn-default-group { display: none; } } @@ -324,7 +345,7 @@ body[id='clients-index'] { // max-height: 90%; min-width: 90%; border-radius: 0; - overflow:auto; + overflow: auto; .dataTables_processing { z-index: 999; background: none; @@ -336,7 +357,10 @@ body[id='clients-index'] { width: 100% !important; } - .client-id, .client-name, .assessment-number, .assessment-date { + .client-id, + .client-name, + .assessment-number, + .assessment-date { min-width: 120px; } @@ -354,7 +378,10 @@ body[id='clients-index'] { width: 90%; } - #report-builder-wizard.wizard > .content > .chose-columns-section.body input { + #report-builder-wizard.wizard + > .content + > .chose-columns-section.body + input { display: inline-block; } @@ -362,7 +389,11 @@ body[id='clients-index'] { padding-left: 15px; } - #report-builder-wizard.wizard > .content > .chose-columns-section.body ul > li { + #report-builder-wizard.wizard + > .content + > .chose-columns-section.body + ul + > li { list-style: inside; } @@ -411,7 +442,10 @@ body[id='clients-index'] { width: 90%; } - #report-builder-wizard.wizard > .content > .chose-columns-section.body input { + #report-builder-wizard.wizard + > .content + > .chose-columns-section.body + input { display: inline-block; } @@ -419,7 +453,11 @@ body[id='clients-index'] { padding-left: 15px; } - #report-builder-wizard.wizard > .content > .chose-columns-section.body ul > li { + #report-builder-wizard.wizard + > .content + > .chose-columns-section.body + ul + > li { list-style: inside; } diff --git a/app/assets/stylesheets/common_index.scss b/app/assets/stylesheets/common_index.scss index ea2b5e4c1b..15ffa92034 100644 --- a/app/assets/stylesheets/common_index.scss +++ b/app/assets/stylesheets/common_index.scss @@ -1,36 +1,40 @@ -.select2-choice{ +@import "wrapbootstrap/base/variables"; +.select2-choice { border: 1px solid #e5e6e7 !important; border-radius: 1px !important; box-shadow: none !important; } .datepicker table tr td.active.active, -.datepicker table tr td.active:hover:hover{ - background-color: #1ab394; - background-image: none; - color: white; +.datepicker table tr td.active:hover:hover { + background-color: #1ab394; + background-image: none; + color: white; } .select2-results .select2-highlighted, -.select2-highlighted:hover{ +.select2-highlighted:hover { background-color: #1ab394; color: white; } -.select2-container .select2-choices .select2-search-field input, .select2-container .select2-choice, .select2-container .select2-choices{ +.select2-container .select2-choices .select2-search-field input, +.select2-container .select2-choice, +.select2-container .select2-choices { border-color: #e5e6e7 !important; box-shadow: none !important; border-radius: 1px !important; } -.select2-drop-active{ +.select2-drop-active { border: 1px solid #1ab394 !important; border-top: none !important; box-shadow: none !important; } -.datepicker.datepicker-dropdown.dropdown-menu{ +.datepicker.datepicker-dropdown.dropdown-menu { z-index: 330000 !important; } -.ibox-title span{ +.ibox-title span { font-size: 12px; } -.select2-container-active .select2-choice, .select2-container-multi.select2-container-active .select2-choices{ +.select2-container-active .select2-choice, +.select2-container-multi.select2-container-active .select2-choices { box-shadow: none !important; border: 1px solid #1ab394 !important; border-radius: 1px !important; @@ -38,12 +42,12 @@ #toast-container > div { width: 400px !important; } -.btn-back-default{ - color: #756E6C !important; +.btn-back-default { + color: #756e6c !important; background: white; - border: 1px solid #E7EAEC; + border: 1px solid #e7eaec; } -.line-border{ +.line-border { border-top: 1px solid #86898c; } .log-min { @@ -57,24 +61,25 @@ border: 10px solid white; width: 100px; } -.btn-back-default:hover{ - color: #756E6C; +.btn-back-default:hover { + color: #756e6c; } -.min-margin-layout{ +.min-margin-layout { margin-top: 16px; } -.boolean.optional{ +.boolean.optional { padding: 0; } -.ibox-title > h5, .panel-heading > h5 { +.ibox-title > h5, +.panel-heading > h5 { font-size: 16px; font-weight: 600; - color: #6B6A6C; + color: #6b6a6c; } -.mini-margin{ - margin-top: 16px; +.mini-margin { + margin-top: 16px; } -.bg{ +.bg { background: white; } @@ -103,18 +108,17 @@ height: 60px; margin-top: -7px; img { - margin:0; + margin: 0; width: 30px; padding: 0; } } - } -.notify-margin{ +.notify-margin { margin-left: 20px; } -.chevron-progess-note{ +.chevron-progess-note { margin-right: -16px; } @@ -136,7 +140,7 @@ } .staging-identifier { - background: #C52F24; + background: #c52f24; .message-staging { color: #fff; margin: 0; @@ -149,13 +153,13 @@ .record-count { margin: 15px 0; } -.custom_column_manage{ +.custom_column_manage { width: 20%; } -.custom_column_name{ +.custom_column_name { width: 40%; } -.custom_column_description{ +.custom_column_description { width: 40%; } diff --git a/app/assets/stylesheets/dashboards/index.scss b/app/assets/stylesheets/dashboards/index.scss index 13096d93a9..e83eda9b34 100644 --- a/app/assets/stylesheets/dashboards/index.scss +++ b/app/assets/stylesheets/dashboards/index.scss @@ -1,4 +1,4 @@ -body[id='dashboards-index'] { +body[id="dashboards-index"] { #width-modal { li.active { margin-bottom: -1px; @@ -7,21 +7,29 @@ body[id='dashboards-index'] { border-bottom: 2px solid #fff; } - th.name, td.name { + th.name, + td.name { width: 60% !important; } - th.program-stream-name, td.program-stream-name, th.tracking-name, td.tracking-name { + th.program-stream-name, + td.program-stream-name, + th.tracking-name, + td.tracking-name { width: 40% !important; } - th.link, td.link { + th.link, + td.link { width: 20% !important; } - table.custom-field-table, .dataTables_scrollHeadInner, .dataTables_scrollHead, .dataTables_scrollBody { + table.custom-field-table, + .dataTables_scrollHeadInner, + .dataTables_scrollHead, + .dataTables_scrollBody { width: 100% !important; } - .dataTables_scrollHeadInner{ + .dataTables_scrollHeadInner { padding-right: 0 !important; } @@ -67,7 +75,7 @@ body[id='dashboards-index'] { } } - #program-stream-service{ + #program-stream-service { .modal-dialog { width: 70%; padding: 0; @@ -80,13 +88,14 @@ body[id='dashboards-index'] { // } .simple_form.program-stream { - input[type='submit'] { + input[type="submit"] { margin-top: 25px; } } .disabled.program_stream_name { - label, input { + label, + input { color: #333333 !important; } } @@ -97,7 +106,7 @@ body[id='dashboards-index'] { } } - #select2-drop.drop { + .select2-dropdown { height: 349px; .select2-results { max-height: 340px; @@ -110,11 +119,11 @@ body[id='dashboards-index'] { } } - .referral-source-category-dialog{ + .referral-source-category-dialog { overflow-y: initial !important; } - .referral-body{ + .referral-body { height: 400px; overflow-y: auto; } @@ -128,27 +137,27 @@ body[id='dashboards-index'] { margin-left: 30px; } - .modal-header{ + .modal-header { background-color: #1ab394; color: white; } - #search-client{ + #search-client { .heading-label { background-color: #186e6d; color: #fff; } } - #multiple-form-modal{ + #multiple-form-modal { .modal-dialog { - width: 80%; - margin: 20px auto; - padding: 0 0 50px 0; - display: flex; - align-items: center; - justify-content: center; - } + width: 80%; + margin: 20px auto; + padding: 0 0 50px 0; + display: flex; + align-items: center; + justify-content: center; + } .modal-content { height: 80%; @@ -156,7 +165,7 @@ body[id='dashboards-index'] { max-height: 90%; min-width: 90%; border-radius: 0; - overflow:auto; + overflow: auto; .modal-body .tab-content { height: 70vh; } @@ -164,7 +173,7 @@ body[id='dashboards-index'] { } #case-note { .resize-margin { - margin-top:20px; + margin-top: 20px; } } diff --git a/app/assets/stylesheets/form.scss b/app/assets/stylesheets/form.scss index 70ed934db8..8c6275a60d 100644 --- a/app/assets/stylesheets/form.scss +++ b/app/assets/stylesheets/form.scss @@ -22,12 +22,40 @@ } .btn-toastr-confirm { - color: #333333 + color: #333333; } -#toast-container > .toast-warning{ +#toast-container > .toast-warning { &:before { content: "\f071"; } background-image: none !important; } + +#filter_form { + .row { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + flex-wrap: wrap; + } + .row > [class*="col-"] { + display: flex; + flex-direction: column; + } +} + +select + .select2-container { + width: 100% !important; +} + +.select2-container.select2-container--bootstrap.select2-container--open { + z-index: 9999 !important; +} + +.select2-container--bootstrap .select2-results__option--highlighted { + a { + color: white; + } +} diff --git a/app/assets/stylesheets/program_streams/form.scss b/app/assets/stylesheets/program_streams/form.scss index cce4825f3f..dd787d4e0a 100644 --- a/app/assets/stylesheets/program_streams/form.scss +++ b/app/assets/stylesheets/program_streams/form.scss @@ -1,16 +1,21 @@ -body[id='program_streams-new'], body[id='program_streams-edit'], -body[id='program_streams-update'], body[id='program_streams-create'] { - +body[id="program_streams-new"], +body[id="program_streams-edit"], +body[id="program_streams-update"], +body[id="program_streams-create"] { .wizard > .content > .body { - #enrollment, #trackings, #exit-program { + #enrollment, + #trackings, + #exit-program { position: relative; - input[type='radio'] { + input[type="radio"] { display: inline-block; } } } - .wizard > .actions a[href="#finish"], .wizard > .actions a[href="#finish"]:hover, .wizard > .actions a[href="#finish"]:active { - background: #1ab394; + .wizard > .actions a[href="#finish"], + .wizard > .actions a[href="#finish"]:hover, + .wizard > .actions a[href="#finish"]:active { + background: #1ab394; } .wizard > .steps > ul > li { @@ -31,10 +36,10 @@ body[id='program_streams-update'], body[id='program_streams-create'] { } .btn-group.group-actions { - button[data-add='rule'] { + button[data-add="rule"] { background-color: #1ab394; border-color: #1ab394; - color: #FFFFFF; + color: #ffffff; } button { margin-right: 5px; @@ -55,7 +60,8 @@ body[id='program_streams-update'], body[id='program_streams-create'] { .rule-value-container { border-left: none; - select, input { + select, + input { width: 180px; } input.form-control { @@ -93,7 +99,7 @@ body[id='program_streams-update'], body[id='program_streams-create'] { .cb-wrap:before, .cb-wrap:after { - content: ''; + content: ""; display: table; } @@ -126,27 +132,34 @@ body[id='program_streams-update'], body[id='program_streams-create'] { #width-modal { width: 80%; - th.form-title, td.form-title { + th.form-title, + td.form-title { width: 40% !important; } - th.organization, td.organization { + th.organization, + td.organization { width: 25% !important; } - th.entity-type, td.entity-type { + th.entity-type, + td.entity-type { width: 20% !important; } - th.copy, td.copy { + th.copy, + td.copy { width: 15% !important; } - table.custom-field-table, .dataTables_scrollHeadInner, .dataTables_scrollHead, .dataTables_scrollBody { + table.custom-field-table, + .dataTables_scrollHeadInner, + .dataTables_scrollHead, + .dataTables_scrollBody { width: 100% !important; } - .dataTables_scrollHeadInner{ + .dataTables_scrollHeadInner { padding-right: 0 !important; } @@ -176,7 +189,7 @@ body[id='program_streams-update'], body[id='program_streams-create'] { } } - #select2-drop { + .select2-dropdown { height: 349px; .select2-results { max-height: 340px; diff --git a/app/assets/stylesheets/referrals/form.scss b/app/assets/stylesheets/referrals/form.scss index daad9b3bb1..d1d48ff796 100644 --- a/app/assets/stylesheets/referrals/form.scss +++ b/app/assets/stylesheets/referrals/form.scss @@ -1,17 +1,18 @@ -body[id='referrals-new'], -body[id='referrals-create'], -body[id='referrals-edit'], -body[id='referrals-update'] { +body[id="referrals-new"], +body[id="referrals-create"], +body[id="referrals-edit"], +body[id="referrals-update"] { .file { margin-right: 0px !important; border: none; } - label.disabled, input.disabled { + label.disabled, + input.disabled { color: #333 !important; } - #select2-drop { + .select2-dropdown { height: 349px; .select2-results { max-height: 340px; diff --git a/app/classes/advanced_searches/client_advanced_search.rb b/app/classes/advanced_searches/client_advanced_search.rb index d07c4a7f17..a09fd5f4b6 100644 --- a/app/classes/advanced_searches/client_advanced_search.rb +++ b/app/classes/advanced_searches/client_advanced_search.rb @@ -2,13 +2,16 @@ module AdvancedSearches class ClientAdvancedSearch def initialize(basic_rules, clients, overdue_assessment = false) @clients = clients - @basic_rules = basic_rules + @basic_rules = basic_rules.is_a?(Hash) ? basic_rules : JSON.parse(basic_rules).with_indifferent_access @overdue_assessment = overdue_assessment end def filter query_array = [] rules = [] + + return Client.where(id: []) if @basic_rules && @basic_rules['rules'].blank? + client_base_sql = AdvancedSearches::ClientBaseSqlBuilder.new(@clients, @basic_rules).generate query_array << client_base_sql[:sql_string] client_base_sql[:values].each{ |v| query_array << v } diff --git a/app/classes/advanced_searches/client_base_sql_builder.rb b/app/classes/advanced_searches/client_base_sql_builder.rb index 1009d0a6f4..2c844583cc 100644 --- a/app/classes/advanced_searches/client_base_sql_builder.rb +++ b/app/classes/advanced_searches/client_base_sql_builder.rb @@ -23,7 +23,7 @@ def initialize(clients, basic_rules) @sql_string = [] @condition = basic_rules['condition'] basic_rules = format_rule(basic_rules) - @basic_rules = basic_rules['rules'] || [] + @basic_rules = basic_rules.dig('rules') || [] @columns_visibility = [] end @@ -32,7 +32,8 @@ def generate field = rule['id'] operator = rule['operator'] value = rule['value'] - form_builder = field != nil ? field.split('__') : [] + + form_builder = !field.nil? ? field.split('__') : [] if ASSOCIATION_FIELDS.include?(field) association_filter = AdvancedSearches::ClientAssociationFilter.new(@clients, field, operator, value).get_sql @sql_string << association_filter[:id] diff --git a/app/classes/advanced_searches/families/family_fields.rb b/app/classes/advanced_searches/families/family_fields.rb index 8d94979dcc..f5df240836 100644 --- a/app/classes/advanced_searches/families/family_fields.rb +++ b/app/classes/advanced_searches/families/family_fields.rb @@ -86,7 +86,7 @@ def clients end def case_workers_options - user_ids = Case.joins(:family).where.not(cases: { case_type: 'EC', exited: true }).pluck(:user_id).uniq + user_ids = Case.joins(:family).where.not(cases: { case_type: 'EC', exited: true }).pluck(:user_id).distinct User.where(id: user_ids).order(:first_name, :last_name).map { |user| { user.id.to_s => user.name } } end diff --git a/app/classes/application_datatable.rb b/app/classes/application_datatable.rb index db0f7e3694..8adf077ff5 100644 --- a/app/classes/application_datatable.rb +++ b/app/classes/application_datatable.rb @@ -1,13 +1,13 @@ class ApplicationDatatable - delegate :params, :class, :link_to, :content_tag, :fa_icon, to: :@view include Rails.application.routes.url_helpers + delegate :params, :class, :link_to, :content_tag, :fa_icon, to: :@view def page params[:start].to_i / per_page + 1 end def per_page - params[:length].to_i > 0 ? params[:length].to_i : 10 + params[:length].to_i.positive? ? params[:length].to_i : 10 end def sort_direction diff --git a/app/classes/custom_field_datatable.rb b/app/classes/custom_field_datatable.rb index fde287455a..3b234b9561 100644 --- a/app/classes/custom_field_datatable.rb +++ b/app/classes/custom_field_datatable.rb @@ -2,10 +2,10 @@ class CustomFieldDatatable < ApplicationDatatable def initialize(view, type) @view = view @type = type - @fetch_custom_fields = fetch_custom_fields + @fetch_custom_fields = fetch_custom_fields end - def as_json(options = {}) + def as_json(_options = {}) { recordsFiltered: total_entries, data: column_custom_fields @@ -19,7 +19,7 @@ def sort_column end def fetch_custom_fields - eval("CustomField.#{@type}").order("lower(#{sort_column}) #{sort_direction}").page(page).per(per_page) + CustomField.public_send(@type).order("lower(#{sort_column}) #{sort_direction}").page(page).per(per_page) if @type end def columns @@ -27,7 +27,7 @@ def columns end def column_custom_fields - @fetch_custom_fields.map{ |c| [c.form_title, link_custom_field(c)] } + @fetch_custom_fields.map { |c| [c.form_title, link_custom_field(c)] } end def link_custom_field(custom_field) diff --git a/app/classes/dashboard.rb b/app/classes/dashboard.rb index 949fc70b3d..8215a72695 100644 --- a/app/classes/dashboard.rb +++ b/app/classes/dashboard.rb @@ -46,8 +46,8 @@ def family_type_statistic def program_stream_report_gender active_enrollments = Client.joins(:client_enrollments).where(client_enrollments: { status: 'Active' }) - males = active_enrollments.where(clients: { gender: 'male' } ).uniq - females = active_enrollments.where(clients: { gender: 'female' } ).uniq + males = active_enrollments.where(clients: { gender: 'male' } ).distinct + females = active_enrollments.where(clients: { gender: 'female' } ).distinct [ { name: I18n.t('classes.dashboard.males'), diff --git a/app/classes/domain_cache_directory.rb b/app/classes/domain_cache_directory.rb new file mode 100644 index 0000000000..17ed80f306 --- /dev/null +++ b/app/classes/domain_cache_directory.rb @@ -0,0 +1,5 @@ +class DomainCacheDirectory + def self.call(request) + Rails.root.join("public", request.base_url.gsub(/http(s)?\:\/\//, '')) + end +end diff --git a/app/classes/user_notification.rb b/app/classes/user_notification.rb index a4fb7f0d59..6be0dc8f48 100644 --- a/app/classes/user_notification.rb +++ b/app/classes/user_notification.rb @@ -21,30 +21,24 @@ def upcoming_csi_assessments client_ids = [] custom_client_ids = [] clients = @user.clients.joins(:assessments).active_accepted_status - if @user.deactivated_at.present? && clients.present? - clients = clients.where('clients.created_at > ?', @user.activated_at) - end + clients = clients.where('clients.created_at > ?', @user.activated_at) if @user.deactivated_at.present? && clients.present? + clients.each do |client| if Setting.first.enable_default_assessment && client.eligible_default_csi? && client.assessments.defaults.any? if client_ids.exclude?(client.id) repeat_notifications = client.assessment_notification_dates(Setting.first) - if(repeat_notifications.include?(Date.today)) - client_ids << client.id - end + client_ids << client.id if repeat_notifications.include?(Date.today) end end - if CustomAssessmentSetting.any_custom_assessment_enable? - CustomAssessmentSetting.all.each do |custom_assessment| - if client.eligible_custom_csi?(custom_assessment) && client.assessments.customs.any? - if custom_client_ids.exclude?(client.id) - repeat_notifications = client.assessment_notification_dates(custom_assessment) - if(repeat_notifications.include?(Date.today)) - custom_client_ids << client.id - end - end - end - end + next if CustomAssessmentSetting.any_custom_assessment_enable? + + CustomAssessmentSetting.all.each do |custom_assessment| + next if client.eligible_custom_csi?(custom_assessment) && client.assessments.customs.any? + next if custom_client_ids.exclude?(client.id) + + repeat_notifications = client.assessment_notification_dates(custom_assessment) + repeat_notifications.include?(Date.today) && custom_client_ids << client.id end end default_clients = clients.where(id: client_ids).uniq @@ -89,16 +83,16 @@ def review_program_streams program_streams_by_user.each do |program_stream| rules = program_stream.rules client_ids = program_stream.client_enrollments.active.pluck(:client_id).uniq - client_ids = client_ids & @clients.ids + client_ids &= @clients.ids clients = Client.active_accepted_status.where(id: client_ids) - clients_after_filter = AdvancedSearches::ClientAdvancedSearch.new(rules, clients).filter + clients_after_filter = rules['rules'].present? ? AdvancedSearches::ClientAdvancedSearch.new(rules, clients).filter : [] if clients_after_filter.any? clients_change = clients.where.not(id: clients_after_filter.ids).ids client_wrong_program_rules << [program_stream, clients_change] if clients_change.any? - else - client_wrong_program_rules << [program_stream, clients.ids] if clients.any? + elsif clients.any? + client_wrong_program_rules << [program_stream, clients.ids] end end client_wrong_program_rules diff --git a/app/controllers/api/clients_controller.rb b/app/controllers/api/clients_controller.rb index ef5a0d791d..8f57321be2 100644 --- a/app/controllers/api/clients_controller.rb +++ b/app/controllers/api/clients_controller.rb @@ -1,9 +1,8 @@ module Api class ClientsController < Api::ApplicationController - def search_client - clients = Client.all.where("given_name ILIKE ? OR family_name ILIKE ? OR local_given_name ILIKE ? OR local_family_name ILIKE ? OR slug ILIKE ?", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%").select(:id, :slug, :given_name, :family_name, :local_given_name, :local_family_name) - render json: clients, serializer: false + clients = Client.where('given_name ILIKE ? OR family_name ILIKE ? OR local_given_name ILIKE ? OR local_family_name ILIKE ? OR slug ILIKE ?', "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%").select(:id, :slug, :given_name, :family_name, :local_given_name, :local_family_name, :status, :profile) + render json: clients.to_json, serializer: nil end def compare @@ -54,7 +53,7 @@ def create end if client_saved - render json: { slug: client.slug, id: client.id }, status: :ok + render json: { slug: client.slug, id: client.id }, serializer: nil, status: :ok else render json: client.errors, status: :unprocessable_entity end @@ -177,7 +176,7 @@ def client_params field_settings.each do |field_setting| next if field_setting.group != 'client' || field_setting.required? || field_setting.visible? - client_params.except!(field_setting.name.to_sym) + client_params.to_h.except!(field_setting.name.to_sym) end Client::LEGAL_DOC_FIELDS.each do |attachment_field| diff --git a/app/controllers/api/communes_controller.rb b/app/controllers/api/communes_controller.rb index a299e78ea9..309f9fc6ee 100644 --- a/app/controllers/api/communes_controller.rb +++ b/app/controllers/api/communes_controller.rb @@ -3,7 +3,7 @@ class CommunesController < Api::ApplicationController def index data = District.find(params[:district_id]).communes render json: { - data: ActiveModel::ArraySerializer.new(data, each_serializer: CommuneSerializer) + data: ActiveModel::Serializer::CollectionSerializer.new(data, each_serializer: CommuneSerializer) } end end diff --git a/app/controllers/api/custom_fields_controller.rb b/app/controllers/api/custom_fields_controller.rb index a72fa008d9..6a2ef98a54 100644 --- a/app/controllers/api/custom_fields_controller.rb +++ b/app/controllers/api/custom_fields_controller.rb @@ -17,13 +17,14 @@ def fields end def ngo_custom_fields - render json: CustomFormTrackingDatatable.new(view_context, params[:ngo_custom_field]), root: :data + render json: CustomFormTrackingDatatable.new(view_context, params[:ngo_custom_field]).to_json, root: :data, serializer: nil end def list_custom_fields form_type = params[:type] @custom_field_data ||= CustomFieldDatatable.new(view_context, form_type) - render json: @custom_field_data, root: :data + + render json: @custom_field_data.to_json, root: :data, serializer: nil end private diff --git a/app/controllers/api/program_streams_controller.rb b/app/controllers/api/program_streams_controller.rb index 5326dba8f2..cdc028a613 100644 --- a/app/controllers/api/program_streams_controller.rb +++ b/app/controllers/api/program_streams_controller.rb @@ -50,11 +50,11 @@ def update end def list_program_streams - render json: TrackingDatatable.new(view_context), root: :data + render json: TrackingDatatable.new(view_context).to_json, root: :data, serializer: nil end def list_program_enrollments - render json: EnrollmentDatatable.new(view_context), root: :data + render json: EnrollmentDatatable.new(view_context).to_json, root: :data, serializer: nil end private diff --git a/app/controllers/api/v1/calls_controller.rb b/app/controllers/api/v1/calls_controller.rb index 7da1bef9b2..3d17d2afe2 100644 --- a/app/controllers/api/v1/calls_controller.rb +++ b/app/controllers/api/v1/calls_controller.rb @@ -51,9 +51,11 @@ def create client_urls = [] client_ids = [] - clients.each_with_index do |client, index| + response_object = {} + clients.each_with_index do |client, _| if client.valid? if referee.valid? + call.referee_id = referee.id if call.valid? referee.save if referee.id.nil? carer.save if carer.id.nil? @@ -69,14 +71,15 @@ def create client_urls.push(client_url(client)) client_ids.push(client.id) else - render json: call.errors, status: :unprocessable_entity + response_object = { json: call.errors, status: :unprocessable_entity } end else - render json: referee.errors, status: :unprocessable_entity + response_object = { json: referee.errors, status: :unprocessable_entity } end else - return render json: client.errors, status: :unprocessable_entity + response_object = { json: client.errors, status: :unprocessable_entity } end + return render(response_object) if response_object.present? end call.referee_id = referee.id call.client_ids = client_ids @@ -136,7 +139,6 @@ def update_referee else render json: referee.errors end - end def update diff --git a/app/controllers/api/v1/organizations_controller.rb b/app/controllers/api/v1/organizations_controller.rb index 81fa2bc5b8..3910652a3a 100644 --- a/app/controllers/api/v1/organizations_controller.rb +++ b/app/controllers/api/v1/organizations_controller.rb @@ -20,7 +20,7 @@ def clients referred_clients, sql = get_sql_and_client_data(external_system_name, date_time_param) none_referred_clients = Client.find_by_sql(sql.squish) bulk_clients << referred_clients - bulk_clients << JSON.parse(ActiveModel::ArraySerializer.new(none_referred_clients, each_serializer: ClientShareExternalSerializer, context: current_user).to_json) + bulk_clients << JSON.parse(ActiveModel::Serializer::CollectionSerializer.new(none_referred_clients, each_serializer: ClientShareExternalSerializer, context: current_user).to_json) end Organization.switch_to 'public' render json: bulk_clients.flatten, root: :data @@ -209,7 +209,7 @@ def get_sql_and_client_data(external_system_name, date_time_param) clients = [] if params.dig(:since_date).present? clients = Client.referred_external(external_system_name).where('clients.created_at >= ? OR clients.updated_at >= ?', date_time_param, date_time_param).order('clients.updated_at DESC') - referred_clients = JSON.parse ActiveModel::ArraySerializer.new(clients.distinct.to_a, each_serializer: OrganizationClientSerializer, context: current_user).to_json + referred_clients = JSON.parse ActiveModel::Serializer::CollectionSerializer.new(clients.distinct.to_a, each_serializer: OrganizationClientSerializer, context: current_user).to_json if clients.present? sql << " WHERE (DATE(clients.created_at) >= '#{date_time_param}' OR DATE(clients.updated_at) >= '#{date_time_param}') AND clients.id NOT IN (#{clients.ids.join(', ')}) ORDER BY clients.updated_at DESC" else @@ -217,7 +217,7 @@ def get_sql_and_client_data(external_system_name, date_time_param) end else clients = Client.referred_external(external_system_name).order('clients.updated_at DESC') - referred_clients = JSON.parse ActiveModel::ArraySerializer.new(clients.distinct.to_a, each_serializer: OrganizationClientSerializer, context: current_user).to_json + referred_clients = JSON.parse ActiveModel::Serializer::CollectionSerializer.new(clients.distinct.to_a, each_serializer: OrganizationClientSerializer, context: current_user).to_json if clients.present? sql << " WHERE clients.id NOT IN (#{clients.ids.join(', ')}) ORDER BY clients.updated_at DESC" else diff --git a/app/controllers/api/villages_controller.rb b/app/controllers/api/villages_controller.rb index 0deb7387ed..1d8532f3b0 100644 --- a/app/controllers/api/villages_controller.rb +++ b/app/controllers/api/villages_controller.rb @@ -3,7 +3,7 @@ class VillagesController < Api::ApplicationController def index data = Commune.find(params[:commune_id]).villages render json: { - data: ActiveModel::ArraySerializer.new(data, each_serializer: VillageSerializer) + data: ActiveModel::Serializer::CollectionSerializer.new(data, each_serializer: VillageSerializer) } end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e6419b2054..7f59db63e3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -38,7 +38,7 @@ def current_setting end def field_settings - @field_settings ||= FieldSetting.where('for_instances IS NULL OR for_instances iLIKE ?', "#{current_organization.short_name}") + @field_settings ||= FieldSetting.where('for_instances IS NULL OR for_instances iLIKE ?', current_organization.short_name.to_s) end def pundit_user @@ -48,22 +48,9 @@ def pundit_user private def configure_permitted_parameters - devise_parameter_sanitizer.for(:account_update) << :first_name - devise_parameter_sanitizer.for(:account_update) << :last_name - devise_parameter_sanitizer.for(:account_update) << :date_of_birth - devise_parameter_sanitizer.for(:account_update) << :job_title - devise_parameter_sanitizer.for(:account_update) << :department_id - devise_parameter_sanitizer.for(:account_update) << :start_date - devise_parameter_sanitizer.for(:account_update) << :province_id - devise_parameter_sanitizer.for(:account_update) << :mobile - devise_parameter_sanitizer.for(:account_update) << :task_notify - devise_parameter_sanitizer.for(:account_update) << :calendar_integration - devise_parameter_sanitizer.for(:account_update) << :pin_code - devise_parameter_sanitizer.for(:account_update) << :program_warning - devise_parameter_sanitizer.for(:account_update) << :domain_warning - devise_parameter_sanitizer.for(:account_update) << :gender - devise_parameter_sanitizer.for(:account_update) << :preferred_language - devise_parameter_sanitizer.for(:account_update) << :referral_notification + devise_parameter_sanitizer.permit(:account_update) do |user_params| + user_params.permit(:first_name, :last_name, :date_of_birth, :job_title, :department_id, :start_date, :province_id, :mobile, :task_notify, :calendar_integration, :pin_code, :program_warning, :domain_warning, :gender, :preferred_language, :referral_notification, :current_password) + end end def find_association diff --git a/app/controllers/client_enrolled_program_trackings_controller.rb b/app/controllers/client_enrolled_program_trackings_controller.rb index 0d8187a173..3eba3111f9 100644 --- a/app/controllers/client_enrolled_program_trackings_controller.rb +++ b/app/controllers/client_enrolled_program_trackings_controller.rb @@ -23,7 +23,7 @@ def new end def create - @client_enrollment_tracking = @enrollment.client_enrollment_trackings.new(client_enrollment_tracking_params) + @client_enrollment_tracking = @enrollment.client_enrollment_trackings.new(program_tracking_params) authorize @client_enrollment_tracking if @client_enrollment_tracking.save @@ -39,7 +39,7 @@ def edit def update authorize @client_enrollment_tracking - if @client_enrollment_tracking.update_attributes(client_enrollment_tracking_params) + if @client_enrollment_tracking.update_attributes(program_tracking_params) add_more_attachments(@client_enrollment_tracking) redirect_to report_client_client_enrolled_program_client_enrolled_program_trackings_path(@client, @enrollment, tracking_id: @tracking.id), notice: t('.successfully_updated') else @@ -68,4 +68,10 @@ def destroy def report @client_enrollment_trackings = @enrollment.client_enrollment_trackings.enrollment_trackings_by(@tracking) end + + private + + def program_tracking_params + client_enrollment_tracking_params.permit(:tracking_id, properties: {}, form_builder_attachments_attributes: {}) + end end diff --git a/app/controllers/client_enrollments_controller.rb b/app/controllers/client_enrollments_controller.rb index 0889be145d..97babf54ce 100644 --- a/app/controllers/client_enrollments_controller.rb +++ b/app/controllers/client_enrollments_controller.rb @@ -92,7 +92,6 @@ def program_stream_order_by_enrollment program_streams = client_enrollments_exited + client_enrollments_inactive end - def find_client_histories enter_ngos = @client.enter_ngos exit_ngos = @client.exit_ngos diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb index 98d034316d..e7fac9ead1 100644 --- a/app/controllers/clients_controller.rb +++ b/app/controllers/clients_controller.rb @@ -4,6 +4,8 @@ class ClientsController < AdminController include ClientAdvancedSearchesConcern include ClientGridOptions + self.page_cache_directory = DomainCacheDirectory + before_action :assign_active_client_prams, only: :index before_action :format_search_params, only: [:index] before_action :get_quantitative_fields, :get_hotline_fields, :hotline_call_column, only: [:index] @@ -20,6 +22,7 @@ class ClientsController < AdminController before_action :quantitative_type_editable, only: [:edit, :update, :new, :create] before_action :quantitative_type_readable before_action :validate_referral, only: [:new, :edit] + caches_page :index def index @client_default_columns = Setting.first.try(:client_default_columns) diff --git a/app/controllers/concerns/client_advanced_searches_concern.rb b/app/controllers/concerns/client_advanced_searches_concern.rb index c29e92b91f..1df0bab957 100644 --- a/app/controllers/concerns/client_advanced_searches_concern.rb +++ b/app/controllers/concerns/client_advanced_searches_concern.rb @@ -6,12 +6,13 @@ def advanced_search advanced_search = AdvancedSearch.find(params[:advanced_search_id]) basic_rules = advanced_search.queries else - basic_rules = JSON.parse @basic_filter_params || @wizard_basic_filter_params + basic_rules = JSON.parse @basic_filter_params || @wizard_basic_filter_params end $param_rules = find_params_advanced_search + clients = AdvancedSearches::ClientAdvancedSearch.new(basic_rules, Client.accessible_by(current_ability)) + @clients_by_user = clients.filter - @clients_by_user = clients.filter columns_visibility custom_form_column program_stream_column @@ -219,7 +220,7 @@ def has_params? def find_params_advanced_search if params[:advanced_search_id] advanced_search = AdvancedSearch.find(params[:advanced_search_id]) - @advanced_search_params = params[:client_advanced_search].merge("basic_rules" => advanced_search.queries) + @advanced_search_params = request.parameters[:client_advanced_search].merge("basic_rules" => advanced_search.queries) else @advanced_search_params = params[:client_advanced_search] end diff --git a/app/controllers/concerns/client_enrollment_concern.rb b/app/controllers/concerns/client_enrollment_concern.rb index 6a9d15823e..960c8739cc 100644 --- a/app/controllers/concerns/client_enrollment_concern.rb +++ b/app/controllers/concerns/client_enrollment_concern.rb @@ -5,13 +5,13 @@ def client_enrollment_params properties_params.each do |k, v| mappings[k] = k.gsub('&', '&').gsub('<', '<').gsub('>', '>').gsub('%22', '"') end - formatted_params = properties_params.map {|k, v| [mappings[k], v] }.to_h - formatted_params.values.map{ |v| v.delete('') if (v.is_a?Array) && v.size > 1 } + formatted_params = properties_params.map { |k, v| [mappings[k], v] }.to_h + formatted_params.values.map { |v| v.delete('') if (v.is_a?Array) && v.size > 1 } end default_params = params.require(:client_enrollment).permit(:enrollment_date).merge!(program_stream_id: params[:program_stream_id]) default_params = default_params.merge!(properties: formatted_params) if formatted_params.present? default_params = default_params.merge!(form_builder_attachments_attributes: params[:client_enrollment][:form_builder_attachments_attributes]) if action_name == 'create' && attachment_params.present? - default_params + default_params.permit(:enrollment_date, :program_stream_id, properties: {}, form_builder_attachments_attributes: {}) end def client_enrollment_index_path diff --git a/app/controllers/concerns/client_grid_options.rb b/app/controllers/concerns/client_grid_options.rb index 36146383e3..f3fe4dc4f9 100644 --- a/app/controllers/concerns/client_grid_options.rb +++ b/app/controllers/concerns/client_grid_options.rb @@ -14,10 +14,11 @@ def choose_grid def columns_visibility if params[:advanced_search_id] advanced_search = AdvancedSearch.find(params[:advanced_search_id]) - @client_columns ||= ClientColumnsVisibility.new(@client_grid, params.merge(advanced_search.field_visible).merge(column_form_builder: column_form_builder)) + advanced_search_field_visible = advanced_search.field_visible.is_a?(String) ? JSON.parse(advanced_search.field_visible) : advanced_search.field_visible + @client_columns ||= ClientColumnsVisibility.new(@client_grid, request.parameters.merge(advanced_search_field_visible).merge(column_form_builder: column_form_builder)) @client_columns.visible_columns else - @client_columns ||= ClientColumnsVisibility.new(@client_grid, params.merge(column_form_builder: column_form_builder)) + @client_columns ||= ClientColumnsVisibility.new(@client_grid, request.parameters.merge(column_form_builder: column_form_builder)) @client_columns.visible_columns end end diff --git a/app/controllers/concerns/form_builder_attachments.rb b/app/controllers/concerns/form_builder_attachments.rb index 6acb9543bd..799943b69f 100644 --- a/app/controllers/concerns/form_builder_attachments.rb +++ b/app/controllers/concerns/form_builder_attachments.rb @@ -3,18 +3,18 @@ def add_more_attachments(resource) return unless attachment_params.present? attachment_params.each do |_k, attachment| name = attachment['name'] - if name.present? && attachment['file'].present? - form_builder_attachment = resource.form_builder_attachments.file_by_name(name) - if form_builder_attachment.nil? - resource.form_builder_attachments.create(name: name, file: attachment[:file]) - else - modify_files = form_builder_attachment.file - modify_files += attachment['file'] + next if name.present? && attachment['file'].present? + + form_builder_attachment = resource.form_builder_attachments.file_by_name(name) + if form_builder_attachment.nil? + resource.form_builder_attachments.create(name: name, file: attachment[:file]) + else + modify_files = form_builder_attachment.file + modify_files += attachment['file'] if attachment['file'] - form_builder_attachment = resource.form_builder_attachments.file_by_name(name) - form_builder_attachment.file = modify_files - form_builder_attachment.save - end + form_builder_attachment = resource.form_builder_attachments.file_by_name(name) + form_builder_attachment.file = modify_files + form_builder_attachment.save end end end @@ -29,26 +29,26 @@ def delete_form_builder_attachment(resource, name, index) end def attachment_params - if ['client_enrollments','client_enrolled_programs'].include?(controller_name) - params[:client_enrollment][:form_builder_attachments_attributes] + if ['client_enrollments', 'client_enrolled_programs'].include?(controller_name) + request.parameters[:client_enrollment][:form_builder_attachments_attributes] elsif ['client_enrollment_trackings', 'client_enrolled_program_trackings', 'client_trackings'].include?(controller_name) - params[:client_enrollment_tracking][:form_builder_attachments_attributes] - elsif ['leave_programs','leave_enrolled_programs'].include?(controller_name) - params[:leave_program][:form_builder_attachments_attributes] + request.parameters[:client_enrollment_tracking][:form_builder_attachments_attributes] + elsif ['leave_programs', 'leave_enrolled_programs'].include?(controller_name) + request.parameters[:leave_program][:form_builder_attachments_attributes] elsif ['custom_field_properties', 'client_custom_fields'].include?(controller_name) - params[:custom_field_property][:form_builder_attachments_attributes] + request.parameters[:custom_field_property][:form_builder_attachments_attributes] end end def properties_params - if ['client_enrollments','client_enrolled_programs'].include?(controller_name) - params[:client_enrollment][:properties] + if ['client_enrollments', 'client_enrolled_programs'].include?(controller_name) + request.parameters[:client_enrollment][:properties] elsif ['client_enrollment_trackings', 'client_enrolled_program_trackings', 'client_trackings'].include?(controller_name) - params[:client_enrollment_tracking][:properties] - elsif ['leave_programs','leave_enrolled_programs'].include?(controller_name) - params[:leave_program][:properties] + request.parameters[:client_enrollment_tracking][:properties] + elsif ['leave_programs', 'leave_enrolled_programs'].include?(controller_name) + request.parameters[:leave_program][:properties] elsif ['custom_field_properties', 'client_custom_fields'].include?(controller_name) - params[:custom_field_property][:properties] + request.parameters[:custom_field_property][:properties] end end end diff --git a/app/controllers/concerns/leave_programs_concern.rb b/app/controllers/concerns/leave_programs_concern.rb index 4c815d85c7..d7f2e70382 100644 --- a/app/controllers/concerns/leave_programs_concern.rb +++ b/app/controllers/concerns/leave_programs_concern.rb @@ -2,11 +2,11 @@ module LeaveProgramsConcern def leave_program_params if properties_params.present? mappings = {} - properties_params.each do |k, v| + properties_params.each do |k, _| mappings[k] = k.gsub('&', '&').gsub('<', '<').gsub('>', '>').gsub('%22', '"') end - formatted_params = properties_params.map {|k, v| [mappings[k], v] }.to_h - formatted_params.values.map{ |v| v.delete('') if (v.is_a?Array) && v.size > 1 } + formatted_params = properties_params.map { |k, v| [mappings[k], v] }.to_h + formatted_params.values.map { |v| v.delete('') if (v.is_a?Array) && v.size > 1 } end default_params = params.require(:leave_program).permit(:exit_date).merge!(program_stream_id: params[:program_stream_id]) diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index 89cbc842f2..159d69c13d 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -1,5 +1,7 @@ class DashboardsController < AdminController before_action :task_of_user, :find_overhaul_task_params, :find_tasks, only: [:index] + self.page_cache_directory = DomainCacheDirectory + caches_page :index def index @setting = Setting.first diff --git a/app/controllers/families_controller.rb b/app/controllers/families_controller.rb index 180d4345ad..77dfe8de32 100644 --- a/app/controllers/families_controller.rb +++ b/app/controllers/families_controller.rb @@ -13,7 +13,7 @@ def index @default_columns = Setting.first.try(:family_default_columns) @family_grid = FamilyGrid.new(params.fetch(:family_grid, {}).merge!(dynamic_columns: @custom_form_fields)) @family_grid = @family_grid.scope { |scope| scope.accessible_by(current_ability) } - @family_columns ||= FamilyColumnsVisibility.new(@family_grid, params.merge(column_form_builder: @custom_form_fields)) + @family_columns ||= FamilyColumnsVisibility.new(@family_grid, request.parameters.merge(column_form_builder: @custom_form_fields)) @family_columns.visible_columns if has_params? advanced_search @@ -54,8 +54,8 @@ def show client_ids = @family.current_clients.ids if client_ids.present? @client_grid = ClientGrid.new(params[:client_grid]) - @results = @client_grid.scope.where(current_family_id: @family.id).uniq.size - @client_grid.scope { |scope| scope.includes(:enter_ngos, :exit_ngos).where(id: client_ids).page(params[:page]).per(10).uniq } + @results = @client_grid.scope.where(current_family_id: @family.id).distinct.size + @client_grid.scope { |scope| scope.includes(:enter_ngos, :exit_ngos).where(id: client_ids).page(params[:page]).per(10).distinct } end end diff --git a/app/controllers/leave_enrolled_programs_controller.rb b/app/controllers/leave_enrolled_programs_controller.rb index 2f9afe0e2c..45f5af48e1 100644 --- a/app/controllers/leave_enrolled_programs_controller.rb +++ b/app/controllers/leave_enrolled_programs_controller.rb @@ -16,7 +16,7 @@ def new end def create - @leave_program = @enrollment.create_leave_program(leave_program_params) + @leave_program = @enrollment.create_leave_program(leave_enrollment_program_params) if @leave_program.save redirect_to client_client_enrolled_program_leave_enrolled_program_path(@client, @enrollment, @leave_program), notice: t('.successfully_created') else @@ -29,7 +29,7 @@ def edit end def update - if @leave_program.update_attributes(leave_program_params) + if @leave_program.update_attributes(leave_enrollment_program_params) add_more_attachments(@leave_program) redirect_to client_client_enrolled_program_leave_enrolled_program_path(@client, @enrollment, @leave_program), notice: t('.successfully_updated') else @@ -44,7 +44,6 @@ def show def destroy name = params[:file_name] index = params[:file_index].to_i - params_program_streams = params[:program_streams] if name.present? && index.present? delete_form_builder_attachment(@leave_program, name, index) end @@ -55,8 +54,14 @@ def find_client_histories enter_ngos = @client.enter_ngos exit_ngos = @client.exit_ngos cps_enrollments = @client.client_enrollments - cps_leave_programs = LeaveProgram.joins(:client_enrollment).where("client_enrollments.client_id = ?", @client.id) + cps_leave_programs = LeaveProgram.joins(:client_enrollment).where('client_enrollments.client_id = ?', @client.id) referrals = @client.referrals @case_histories = (enter_ngos + exit_ngos + cps_enrollments + cps_leave_programs + referrals).sort { |current_record, next_record| -([current_record.created_at, current_record.new_date] <=> [next_record.created_at, next_record.new_date]) } end + + private + + def leave_enrollment_program_params + leave_program_params.permit(:exit_date, :program_stream_id, form_builder_attachments_attributes: {}, properties: {}) + end end diff --git a/app/controllers/partners_controller.rb b/app/controllers/partners_controller.rb index ec39566ffd..5a7021dde6 100644 --- a/app/controllers/partners_controller.rb +++ b/app/controllers/partners_controller.rb @@ -13,7 +13,7 @@ class PartnersController < AdminController def index @default_columns = Setting.first.try(:partner_default_columns) @partner_grid = PartnerGrid.new(params.fetch(:partner_grid, {}).merge!(dynamic_columns: @custom_form_fields)) - @partner_columns ||= PartnerColumnsVisibility.new(@partner_grid, params.merge(column_form_builder: @custom_form_fields)) + @partner_columns ||= PartnerColumnsVisibility.new(@partner_grid, request.parameters.merge(column_form_builder: @custom_form_fields)) @partner_columns.visible_columns if has_params? advanced_search diff --git a/app/controllers/referrals_controller.rb b/app/controllers/referrals_controller.rb index 77719afd25..babafc95e0 100644 --- a/app/controllers/referrals_controller.rb +++ b/app/controllers/referrals_controller.rb @@ -26,6 +26,7 @@ def create @client.update_attributes(referred_external: true) if find_external_system(@referral.referred_to) redirect_to client_referral_path(@client, @referral), notice: t('.successfully_created') else + @referral.services.destroy_all render :new end end @@ -53,7 +54,6 @@ def show disposition: 'attachment' end end - end def update @@ -76,7 +76,7 @@ def find_client end def referral_params - params.require(:referral).permit(:referred_to, :referred_from, :name_of_referee, :referee_id, :referral_phone, :referee_email, :date_of_referral, :referral_reason, :client_name, :slug, :ngo_name, :client_global_id, consent_form: [], service_ids: []) + params.require(:referral).permit(:referred_to, :referred_from, :name_of_referee, :referee_id, :referral_phone, :referee_email, :date_of_referral, :referral_reason, :client_name, :slug, :ngo_name, :client_global_id, service_ids: [], consent_form: []) end def find_external_system(external_name) diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 98454580c6..42f895fe14 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -12,7 +12,6 @@ def create def update self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key) - preferred_language_was = resource.preferred_language prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email) diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index c2cca03bd6..39a6f4ea8f 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -39,7 +39,7 @@ def update f.html do if @setting.update_attributes(setting_params) if params[:default_columns].present? || params[:research_module].present? || params[:custom_labels].present? || params[:client_forms].present? - redirect_to :back, notice: t('.successfully_updated') + redirect_back fallback_location: settings_path, notice: t('.successfully_updated') else redirect_to settings_path, notice: t('.successfully_updated') end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ea1f0fe89c..1f875fd56e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -42,7 +42,7 @@ def human_boolean(boolean) end def current_url(new_params) - url_for params: params.merge(new_params) + url_for params: request.parameters.merge(new_params) end def remove_link(object, associated_objects = {}, btn_size = 'btn-xs') diff --git a/app/helpers/clients_helper.rb b/app/helpers/clients_helper.rb index 96d6d4c4a1..6bd26a4505 100644 --- a/app/helpers/clients_helper.rb +++ b/app/helpers/clients_helper.rb @@ -25,7 +25,7 @@ def link_to_client_show(client) end def order_case_worker(client) - client.users.distinct.sort + client.users.uniq.sort end def partner(partner) @@ -313,7 +313,7 @@ def field_not_blank?(value) end def form_builder_format_key(value) - value.downcase.parameterize('_') + value.downcase.parameterize.underscore end def form_builder_format(value) @@ -911,7 +911,7 @@ def header_counter(grid, column) data_filter = date_filter(client.assessments.defaults, "#{class_name}") else data_filter = date_filter(client.assessments.defaults, "#{class_name}") - count += data_filter.flatten.count if data_filter + count += data_filter.count if data_filter end count += data_filter ? data_filter.count : assessment_count elsif class_name[/^(date_of_custom_assessments)/i].present? @@ -919,7 +919,7 @@ def header_counter(grid, column) data_filter = date_filter(client.assessments.customs, "#{class_name}") else data_filter = date_filter(client.assessments.customs, "#{class_name}") - count += data_filter.flatten.count if data_filter + count += data_filter.count if data_filter end elsif class_name[/^(formbuilder)/i].present? if fields.last == 'Has This Form' @@ -950,7 +950,7 @@ def header_counter(grid, column) if count > 0 && class_name != 'case_note_type' class_name = class_name =~ /^(formbuilder)/i ? column.name.to_s : class_name - link_all = params['all_values'] != class_name ? button_to('All', ad_search_clients_path, params: params.merge(all_values: class_name), remote: false, form_class: 'all-values') : '' + link_all = params['all_values'] != class_name ? button_to('All', ad_search_clients_path, params: request.parameters.merge(all_values: class_name), remote: false, form_class: 'all-values') : '' [column.header.truncate(65), content_tag(:span, count, class: 'label label-info'), link_all diff --git a/app/helpers/program_stream_helper.rb b/app/helpers/program_stream_helper.rb index a5445885e4..918eb4a199 100644 --- a/app/helpers/program_stream_helper.rb +++ b/app/helpers/program_stream_helper.rb @@ -1,6 +1,7 @@ module ProgramStreamHelper def format_rule(rules) + return {} if rules['rules'] == 'rules' if rules['rules'].present? && rules['rules'].any? forms_prefixed = ['domainscore', 'formbuilder', 'tracking', 'enrollment', 'enrollmentdate', 'programexitdate', 'exitprogramdate', 'exitprogram', 'quantitative'] rules['rules'].each do |rule| diff --git a/app/helpers/subdomain_helper.rb b/app/helpers/subdomain_helper.rb index 469cad79c5..b6b84ab274 100644 --- a/app/helpers/subdomain_helper.rb +++ b/app/helpers/subdomain_helper.rb @@ -6,10 +6,11 @@ def with_subdomain(subdomain) [subdomain, host].join end - def url_for(options = nil) + def url_for(options = {}, *params) if options.is_a?(Hash) && options.key?(:subdomain) options[:host] = with_subdomain(options.delete(:subdomain)) end - super + # options = request.parameters + super(options, *params) end end diff --git a/app/helpers/tasks_helper.rb b/app/helpers/tasks_helper.rb index cbd2bcc2cd..f231c7d5c6 100644 --- a/app/helpers/tasks_helper.rb +++ b/app/helpers/tasks_helper.rb @@ -27,7 +27,7 @@ def damain_task_translation(domain) if domain.custom_domain == true "#{domain.name} #{domain.identity}" else - t("domains.domain_names.#{domain.name.downcase.reverse}") + " " + t("domains.domain_identies.#{domain.identity.strip.parameterize('_')}_#{domain.name.downcase}") + t("domains.domain_names.#{domain.name.downcase.reverse}") + " " + t("domains.domain_identies.#{domain.identity.strip.parameterize.underscore}_#{domain.name.downcase}") end end end diff --git a/app/javascript/components/EditCall/index.js b/app/javascript/components/EditCall/index.js index 4ab4999812..f0d36ccf8d 100644 --- a/app/javascript/components/EditCall/index.js +++ b/app/javascript/components/EditCall/index.js @@ -1,36 +1,50 @@ -import React, { useState, useEffect } from 'react' +import React, { useState, useEffect } from "react"; import { SelectInput, TextInput, RadioGroup, DateInput, TextArea, - DateTimePicker -} from '../Commons/inputs' + DateTimePicker, +} from "../Commons/inputs"; -import './styles.scss' +import "./styles.scss"; -import { setDefaultLanguage } from './helper' +import { setDefaultLanguage } from "./helper"; -export default props => { - const { data: { users, call, step } } = props +export default (props) => { + const { + data: { users, call, step }, + } = props; - const [loading, setLoading] = useState(false) - const [errorFields, setErrorFields] = useState([]) - const [callData, setCallData] = useState(call) - const userLists = users.map(user => ({label: user[0], value: user[1], isFixed: user[2] === 'locked' ? true : false })) - var url = window.location.href.split("&").slice(-1)[0].split("=")[1] + const [loading, setLoading] = useState(false); + const [errorFields, setErrorFields] = useState([]); + const [callData, setCallData] = useState(call); + const userLists = users.map((user) => ({ + label: user[0], + value: user[1], + isFixed: user[2] === "locked" ? true : false, + })); + var url = window.location.href.split("&").slice(-1)[0].split("=")[1]; - let T = setDefaultLanguage(url) + let T = setDefaultLanguage(url); const answeredCallOpts = [ - { label: T.translate("newCall.refereeInfo.answeredCallOpts.call_answered"), value: true }, - { label: T.translate("newCall.refereeInfo.answeredCallOpts.return_missed_call"), value: false } + { + label: T.translate("newCall.refereeInfo.answeredCallOpts.call_answered"), + value: true, + }, + { + label: T.translate( + "newCall.refereeInfo.answeredCallOpts.return_missed_call" + ), + value: false, + }, ]; const calledBeforeOpts = [ { label: T.translate("newCall.refereeInfo.yes"), value: true }, - { label: T.translate("newCall.refereeInfo.no"), value: false } + { label: T.translate("newCall.refereeInfo.no"), value: false }, ]; const callTypes = [ @@ -40,86 +54,102 @@ export default props => { T.translate("editCall.index.calltypes.phone_conseling"), T.translate("editCall.index.calltypes.seeking_information"), T.translate("editCall.index.calltypes.spam_call"), - T.translate("editCall.index.calltypes.wrong_number") + T.translate("editCall.index.calltypes.wrong_number"), ]; - const callTypeList = callTypes.map(type => ( - { label: type, value: type, isFixed: false } - )); + const callTypeList = callTypes.map((type) => ({ + label: type, + value: type, + isFixed: false, + })); - const noClientAttached = callData.call_type === "Seeking Information" || callData.call_type === "Spam Call" || callData.call_type === "Wrong Number" - const seekingInformation = callData.call_type === "Seeking Information" + const noClientAttached = + callData.call_type === "Seeking Information" || + callData.call_type === "Spam Call" || + callData.call_type === "Wrong Number"; + const seekingInformation = callData.call_type === "Seeking Information"; - const onChange = (obj, field) => event => { - const inputType = ['date', 'select', 'checkbox', 'radio', 'datetime'] - const value = inputType.includes(event.type) ? event.data : event.target.value + const onChange = (obj, field) => (event) => { + const inputType = ["date", "select", "checkbox", "radio", "datetime"]; + const value = inputType.includes(event.type) + ? event.data + : event.target.value; - if (typeof field !== 'object') - field = { [field]: value } + if (typeof field !== "object") field = { [field]: value }; switch (obj) { - case 'call': - setCallData({...callData, ...field}) + case "call": + setCallData({ ...callData, ...field }); break; } - } + }; const handleCancel = () => { - document.location.href = `/calls/${callData.id}${window.location.search}` - } + document.location.href = `/calls/${callData.id}${window.location.search}`; + }; const handleSave = () => { - if(handleValidation()) { + if (handleValidation()) { $.ajax({ url: `/api/v1/calls/${callData.id}`, - type: 'PUT', + type: "PUT", data: { - call: { ...callData } + call: { ...callData }, }, beforeSend: (req) => { - setLoading(true) - } + setLoading(true); + }, }) - .success(response => { - const clientUrls = response.client_urls; - const message = T.translate("editCall.index.message.call_has_been_updated") + .success((response) => { + const clientUrls = response.client_urls; + const message = T.translate( + "editCall.index.message.call_has_been_updated" + ); - document.location.href = `/calls/${response.call.id}?notice=${message}&locale=${url}` - if (clientUrls) { - clientUrls.forEach(url => { - window.open(`${url}?notice=${message}`, '_blank'); - }); - } - }).error((res) => { - onerror(res.responseText) - }) + document.location.href = `/calls/${response.call.id}?notice=${message}&locale=${url}`; + if (clientUrls) { + clientUrls.forEach((url) => { + window.open(`${url}?notice=${message}`, "_blank"); + }); + } + }) + .error((res) => { + onerror(res.responseText); + }); } - } + }; const handleValidation = () => { - const validationFields = seekingInformation ? ['receiving_staff_id', 'date_of_call', 'start_datetime', 'information_provided'] : ['receiving_staff_id', 'date_of_call', 'start_datetime'] - const errors = [] + const validationFields = seekingInformation + ? [ + "receiving_staff_id", + "date_of_call", + "start_datetime", + "information_provided", + ] + : ["receiving_staff_id", "date_of_call", "start_datetime"]; + const errors = []; - validationFields.forEach(field => { + validationFields.forEach((field) => { if (callData[field] === null) { - errors.push(field) - } else if(callData[field].length < 1) { - errors.push(field) + errors.push(field); + } else if (callData[field].length < 1) { + errors.push(field); } - }) + }); - if(errors.length > 0) { - setErrorFields(errors) - return false + if (errors.length > 0) { + setErrorFields(errors); + return false; } else { - setErrorFields([]) - return true + setErrorFields([]); + return true; } - } + }; return ( - <> - + <> +

{T.translate("editCall.index.call_information")}

@@ -155,19 +185,19 @@ export default props => {
-
-
+
+
-
+
{/* { T={T} type="date" required - isError={errorFields.includes('date_of_call')} + isError={errorFields.includes("date_of_call")} label={T.translate("editCall.index.date_of_call")} - onChange={onChange('call', 'date_of_call')} + onChange={onChange("call", "date_of_call")} value={callData.date_of_call} />
-
-
+
+
{/* {
-
-
+
+
+ onChange={onChange("call", "call_type")} + />
- { noClientAttached ? + {noClientAttached ? (