diff --git a/app/assets/stylesheets/uswds-components.scss b/app/assets/stylesheets/uswds-components.scss index 29893efc3..c699302f6 100644 --- a/app/assets/stylesheets/uswds-components.scss +++ b/app/assets/stylesheets/uswds-components.scss @@ -4,4 +4,7 @@ @forward "usa-header"; @forward "usa-banner"; @forward "usa-section"; +@forward "usa-alert"; +@forward "usa-combo-box"; +@forward "usa-accordion"; // add additional packages here as you use them diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 45f463e4c..a90b6d357 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -1,4 +1,4 @@ class PagesController < ApplicationController - def home + def welcome end end diff --git a/app/controllers/providers_controller.rb b/app/controllers/providers_controller.rb new file mode 100644 index 000000000..1b7a95de7 --- /dev/null +++ b/app/controllers/providers_controller.rb @@ -0,0 +1,26 @@ +class ProvidersController < ApplicationController + ENDPOINT = 'https://sampleapps.argyle.com/employer-search/api/search?q='; + + def index + end + + def search + # sample endpoint — let's replace with a real sandbox + # https://sampleapps.argyle.com/employer-search/api/search?q=nava + # results = Net::HTTP.get(URI.parse("#{ENDPOINT}#{params.q}")) + end + + def confirm + @employer = employer_params[:employer] + @payments = [ + { amount: 810, start: 'March 25', end: 'June 15', hours: 54, rate: 15 }, + { amount: 195, start: 'January 1', end: 'February 23', hours: 13, rate: 15 } + ] + end + + private + + def employer_params + params.permit(:employer) + end +end diff --git a/app/helpers/providers_helper.rb b/app/helpers/providers_helper.rb new file mode 100644 index 000000000..b2e719df1 --- /dev/null +++ b/app/helpers/providers_helper.rb @@ -0,0 +1,2 @@ +module ProvidersHelper +end diff --git a/app/javascript/controllers/hello_controller.js b/app/javascript/controllers/hello_controller.js deleted file mode 100644 index 5975c0789..000000000 --- a/app/javascript/controllers/hello_controller.js +++ /dev/null @@ -1,7 +0,0 @@ -import { Controller } from "@hotwired/stimulus" - -export default class extends Controller { - connect() { - this.element.textContent = "Hello World!" - } -} diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js index d0685d3b7..99af13b6d 100644 --- a/app/javascript/controllers/index.js +++ b/app/javascript/controllers/index.js @@ -4,5 +4,6 @@ import { application } from "./application" -import HelloController from "./hello_controller" -application.register("hello", HelloController) +import ProvidersController from "./providers_controller" +application.register("providers", ProvidersController) + diff --git a/app/javascript/controllers/providers_controller.js b/app/javascript/controllers/providers_controller.js new file mode 100644 index 000000000..88d18b972 --- /dev/null +++ b/app/javascript/controllers/providers_controller.js @@ -0,0 +1,44 @@ +import { Controller } from "@hotwired/stimulus" + +function toOptionHTML({ value }) { + return ``; +} + +const DEFAULT_OPTIONS = [ + { + value: 'Uber' + }, + { + value: 'Instacart' + }, + { + value: 'Walmart' + }, + { + value: 'Lyft' + } +].map(toOptionHTML); + +export default class extends Controller { + static targets = ["options", "continue"]; + + selection = null; + + connect() { + if (this.hasOptionsTarget) { + this.optionsTarget.innerHTML = DEFAULT_OPTIONS; + } + } + + search(event) { + const input = event.target.value; + this.optionsTarget.innerHTML = [...DEFAULT_OPTIONS, toOptionHTML({ value: input })].join(''); + } + + select(event) { + console.log(event.detail); + this.selection = event.detail; + + this.continueTarget.disabled = false; + } +} diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e61fb155d..939c754b1 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,7 +1,7 @@ - IvCbvPayroll + Verify.gov <%= csrf_meta_tags %> <%= csp_meta_tag %> @@ -19,7 +19,7 @@ <%= render "application/usa_banner" %> <%= render "application/header" %>
-
+
<%= yield %>
diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb deleted file mode 100644 index 159202e87..000000000 --- a/app/views/pages/home.html.erb +++ /dev/null @@ -1 +0,0 @@ -

Hello world

diff --git a/app/views/pages/welcome.html.erb b/app/views/pages/welcome.html.erb new file mode 100644 index 000000000..8c5dc06f8 --- /dev/null +++ b/app/views/pages/welcome.html.erb @@ -0,0 +1,16 @@ +

Hello, Matt

+

Let's verify your payment information.

+ +

We'll connect to your payment records to get proof of payments to your caseworker and get benfits faster.

+ +
+
+

+ Your information is secure. We will not share or keep your log in information. You will be able to preview and approve everything that is shared with your caseworker. +

+
+
+ +<%= link_to '/providers' do %> + +<% end %> diff --git a/app/views/providers/confirm.html.erb b/app/views/providers/confirm.html.erb new file mode 100644 index 000000000..9f3e05774 --- /dev/null +++ b/app/views/providers/confirm.html.erb @@ -0,0 +1,25 @@ +

Review payment information from <%= @employer %>

+

Below is payment information from <%= @employer %> for the past 90 days.

+ +

Total Payments: $<%= @payments.reduce(0) { |sum, payment| sum + payment[:amount] } %>

+
+ <% @payments.each_with_index do |payment, index| %> +
+ +
+
+

+ <%= payment[:hours] %> hours at $<%= payment[:rate] %> per hour. +

+
+ <% end %> +
+ + diff --git a/app/views/providers/index.html.erb b/app/views/providers/index.html.erb new file mode 100644 index 000000000..ab267a1b2 --- /dev/null +++ b/app/views/providers/index.html.erb @@ -0,0 +1,11 @@ +

Get payment info from your employer.

+ +
+ +
+ +
+ +
diff --git a/config/locales/en.yml b/config/locales/en.yml index 3165d6217..01d08ed55 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -16,7 +16,7 @@ en: demo_banner: TEST SITE - Do not use real personal information (demo purposes only) - TEST SITE menu: Menu primary: Primary navigation - title: Iv Cbv Payroll + title: Verify.gov languages: en: English es: Español diff --git a/config/routes.rb b/config/routes.rb index 4f83cf729..066dafaaa 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,10 +6,15 @@ end scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do # Your application routes go here - root "pages#home" - # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html + root "pages#welcome" + # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html + get "providers/search" => "providers#search" + get "providers/confirm" => "providers#confirm" + resources :providers # Defines the root path route ("/") # root "articles#index" + + end end diff --git a/spec/helpers/providers_helper_spec.rb b/spec/helpers/providers_helper_spec.rb new file mode 100644 index 000000000..84cc5b923 --- /dev/null +++ b/spec/helpers/providers_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the ProvidersHelper. For example: +# +# describe ProvidersHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe ProvidersHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/requests/providers_spec.rb b/spec/requests/providers_spec.rb new file mode 100644 index 000000000..6a1fa61f3 --- /dev/null +++ b/spec/requests/providers_spec.rb @@ -0,0 +1,7 @@ +require 'rails_helper' + +RSpec.describe "Providers", type: :request do + describe "GET /index" do + pending "add some examples (or delete) #{__FILE__}" + end +end diff --git a/spec/views/pages/home.html.erb_spec.rb b/spec/views/pages/welcome.html.erb_spec similarity index 55% rename from spec/views/pages/home.html.erb_spec.rb rename to spec/views/pages/welcome.html.erb_spec index 6ce2e2afb..63a6d9dd4 100644 --- a/spec/views/pages/home.html.erb_spec.rb +++ b/spec/views/pages/welcome.html.erb_spec @@ -1,8 +1,8 @@ require "rails_helper" -RSpec.describe "pages/home.html.erb", type: :view do +RSpec.describe "pages/welcome.html.erb", type: :view do it "displays the gov banner" do - render template: "pages/home", layout: "layouts/application" + render template: "pages/welcome", layout: "layouts/application" expect(rendered).to match "An official website of the United States government" end end