diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 5a173fd5..3971f8d2 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -126,6 +126,19 @@ margin-bottom: 0; } +.light-button { + border: 2px solid #3a67e8; + color: #3a67e8; + background-color: inherit; + border-radius: 3px; + margin-bottom: 0; +} + +.light-button:hover { + background-color: #3a67e8; + color: white; +} + .active-topic { background-color: #F3F2F1; padding: 20px 0; diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e13dcc1f..19b0b724 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -42,6 +42,10 @@ def disable_feedback @disable_feedback = true end + def disable_current_topic + @active_current_topic = nil + end + private def set_default_metadata diff --git a/app/controllers/apps/president_vote_app/application_forms_controller.rb b/app/controllers/apps/president_vote_app/application_forms_controller.rb new file mode 100644 index 00000000..aa155798 --- /dev/null +++ b/app/controllers/apps/president_vote_app/application_forms_controller.rb @@ -0,0 +1,64 @@ +class Apps::PresidentVoteApp::ApplicationFormsController < ApplicationController + helper FormatDaysHelper + before_action :set_metadata, :check_inactive_president_application, :disable_current_topic + before_action :disable_feedback, only: [:show, :delivery, :create] + + def show + render_step('start') + end + + def delivery + return render_self if request.post? + render_step('delivery') + end + + def permanent_resident + return render_self if request.post? + render_step('permanent_resident') + end + + def create + render_self + end + + private def render_self + @application_form = Apps::PresidentVoteApp::ApplicationForm.new(form_params) + @application_form.run(self) + end + + private def render_step(step) + @application_form = Apps::PresidentVoteApp::ApplicationForm.new(step: step) + render step + end + + private def form_params + params.require(:apps_president_vote_app_application_form).permit( + :step, + :place_first_round, + :place_second_round, + :sk_citizen, + :delivery, + :full_name, :pin, :nationality, :maiden_name, + :authorized_person_full_name, :authorized_person_pin, + :street, :pobox, :municipality, + :same_delivery_address, + :delivery_street, :delivery_pobox, :delivery_municipality, :delivery_country, + :municipality_email, + :municipality_email_verified, + :permanent_resident, + :back + ) + end + + private def set_metadata + @metadata.og.title = 'Žiadosť o hlasovací preukaz' + @metadata.og.image = 'https://volby.digital/images/share-2024.png' + @metadata.og.description = 'Aj keď budete počas volieb mimo trvalého pobytu, voliť sa dá. Stačí požiadať.' + end + + private def check_inactive_president_application + return if Apps::PresidentVoteApp::ApplicationForm.active? + return redirect_to apps_president_vote_app_application_forms_path if action_name != "show" + render 'inactive' + end +end diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb index abfeb52d..76c84e0e 100644 --- a/app/controllers/health_controller.rb +++ b/app/controllers/health_controller.rb @@ -1,5 +1,44 @@ class HealthController < ApplicationController + def index - head :ok + database_check_results = check_db_connections + if all_database_healthy?(database_check_results) + render json: {status: "ok"}, status: :ok + else + render json: {status: "fail"}, status: :internal_server_error + end + rescue StandardError + render json: {status: "fail"}, status: :internal_server_error + end + + private + def all_database_healthy?(database_check_results) + database_check_results.values.all? { |status| status[:status] == "ok" } + end + + def check_db_connections + db_status = {} + databases.each do |role, connection| + db_status[role] = perform_health_check(connection) + ensure + ActiveRecord::Base.clear_active_connections! + end + db_status + end + + def databases + { + primary: ActiveRecord::Base.connected_to(role: :writing) { ApplicationRecord.connection }, + datahub: ActiveRecord::Base.connected_to(role: :reading) { DatahubRecord.connection } + } + end + + def perform_health_check(connection) + if connection + connection.execute('SELECT 1') + {status: 'ok'} + else + {status: 'fail'} + end end end diff --git a/app/helpers/format_days_helper.rb b/app/helpers/format_days_helper.rb index 61a76c47..3381de29 100644 --- a/app/helpers/format_days_helper.rb +++ b/app/helpers/format_days_helper.rb @@ -11,6 +11,16 @@ def format_remaining_days(remaining_days) "Dnes je posledný možný termín." end end -end - + def format_remaining_days_count(remaining_days) + if remaining_days > 4 + "#{remaining_days} dní" + elsif remaining_days > 1 + "#{remaining_days} dni" + elsif remaining_days == 1 + "1 deň" + elsif remaining_days == 0 + "posledný deň" + end + end +end diff --git a/app/models/apps/parliament_vote_app/application_form.rb b/app/models/apps/parliament_vote_app/application_form.rb index 0dcc9b65..ef903cf1 100644 --- a/app/models/apps/parliament_vote_app/application_form.rb +++ b/app/models/apps/parliament_vote_app/application_form.rb @@ -40,6 +40,7 @@ class ApplicationForm on: [:identity, :world_sk_permanent_resident, :world_abroad_permanent_resident, :authorized_person] validates_presence_of :pin, message: 'Rodné číslo je povinná položka', on: [:identity, :world_sk_permanent_resident, :world_abroad_permanent_resident, :authorized_person] + # validate :pin_is_ok, on: [:identity, :world_sk_permanent_resident, :world_abroad_permanent_resident, :authorized_person] validates_presence_of :street, message: 'Zadajte ulicu alebo názov obce ak obec nemá ulice', on: [:identity, :world_sk_permanent_resident, :authorized_person] validates_presence_of :pobox, message: 'Zadajte poštové smerové čislo', @@ -155,6 +156,33 @@ def world_sk_resident_email_body ) end + private def pin_is_ok + return errors.add(:pin, 'Rodné číslo je pocinná položka') if pin.blank? + + begin + pin.to_i + rescue ArgumentError + return errors.add(:pin, 'Rodné číslo obsahuje neplatné znaky') + end + + pin = self.pin.gsub(%r{/}, '') + return errors.add(:pin, 'Rodné číslo nie je deliteľné číslom 11') if pin.length == 10 and pin.to_i % 11 != 0 + return errors.add(:pin, 'Rodné číslo má nesprávnu dĺžku') if pin.length != 10 and pin.length != 9 + + case pin[2..3].to_i + when 0, 13..50, 63..99 + return errors.add(:pin, 'Rodné číslo obsahuje neplatný mesiac') + end + + month = pin[2..3].to_i % 50 + year = pin[0..1].to_i + (pin[2..3].to_i > 12 ? 1900 : 2000) + begin + Date.new(year, month, pin[4..5].to_i) + rescue ArgumentError + errors.add(:pin, 'Rodné číslo obsahuje neplatný dátum') + end + end + def run(listener) case step when 'start' @@ -192,7 +220,10 @@ def run(listener) end private def sk_citizen_step(listener) - if valid?(:sk_citizen) + if go_back? + self.step = 'start' + listener.render :start + elsif valid?(:sk_citizen) case sk_citizen when 'yes' self.step = 'permanent_resident' @@ -206,7 +237,10 @@ def run(listener) end private def permanent_resident_step(listener) - if valid?(:permanent_resident) + if go_back? + self.step = 'sk_citizen' + listener.render :sk_citizen + elsif valid?(:permanent_resident) case permanent_resident when 'yes' self.step = 'place' @@ -241,7 +275,10 @@ def run(listener) # Home flow private def delivery_step(listener) - if valid?(:delivery) + if go_back? + self.step = 'place' + listener.render :place + elsif valid?(:delivery) case delivery when 'post' self.step = 'identity' diff --git a/app/models/apps/president_vote_app/application_form.rb b/app/models/apps/president_vote_app/application_form.rb new file mode 100644 index 00000000..af529e32 --- /dev/null +++ b/app/models/apps/president_vote_app/application_form.rb @@ -0,0 +1,367 @@ +module Apps + module PresidentVoteApp + class ApplicationForm + FIRST_ROUND_DATE = Date.parse('2024-03-23') + FIRST_ROUND_REQUEST_SENDING_DEADLINE = FIRST_ROUND_DATE - 19.day + SECOND_ROUND_REQUEST_SENDING_DEADLINE = FIRST_ROUND_DATE - 9.day + + include ActiveModel::Model + + attr_accessor :step + attr_accessor :place_first_round + attr_accessor :place_second_round + attr_accessor :place + attr_accessor :sk_citizen + attr_accessor :permanent_resident + attr_accessor :delivery + attr_accessor :full_name, :pin + attr_accessor :authorized_person_full_name, :authorized_person_pin + attr_accessor :street, :pobox, :municipality + attr_accessor :same_delivery_address + attr_accessor :delivery_street, :delivery_pobox, :delivery_municipality, :delivery_country + attr_accessor :municipality_email + attr_accessor :municipality_email_verified + attr_accessor :back + + validates_presence_of :place_second_round, message: 'Vyberte si jednu z možností v druhom kole', + on: [:place_second_round] + + validates_presence_of :sk_citizen, message: 'Vyberte áno pokiaľ ste občan Slovenskej republiky', on: :sk_citizen + validates_presence_of :permanent_resident, message: 'Vyberte áno pokiaľ máte trvalý pobyt na Slovensku', on: :permanent_resident + + validates_presence_of :delivery, message: 'Vyberte si spôsob prevzatia hlasovacieho preukazu', on: :delivery + validates_exclusion_of :delivery, in: %w(post authorized_person), + if: -> { request_sending_expired? }, + message: 'Lehota na zaslanie žiadosti o hlasovací preukaz uplynula 10.2.2020.', on: :delivery + validates_exclusion_of :delivery, in: %w(person), + if: -> { pickup_expired? }, + message: 'Termín na vybavenie hlasovacieho preukazu uplynul 28.2.2020.', on: :delivery + + validates_presence_of :full_name, message: 'Meno je povinná položka', + on: [:identity, :world_abroad_permanent_resident, :authorized_person] + validates_presence_of :pin, message: 'Rodné číslo je povinná položka', + on: [:identity, :world_abroad_permanent_resident, :authorized_person] + # validate :pin_is_ok, on: [:identity, :world_abroad_permanent_resident, :authorized_person] + validates_presence_of :street, message: 'Zadajte ulicu alebo názov obce ak obec nemá ulice', + on: [:identity, :authorized_person] + validates_presence_of :pobox, message: 'Zadajte poštové smerové čislo', + on: [:identity, :authorized_person] + validates_presence_of :municipality, message: 'Vyberte obec', + on: [:identity, :authorized_person] + + validates_presence_of :authorized_person_full_name, message: 'Meno splnomocnenej osoby je povinná položka', + on: [:authorized_person] + validates_presence_of :authorized_person_pin, message: 'Číslo občianskeho preukazu splnomocnenej osoby je povinná položka', + on: [:authorized_person] + + validates_presence_of :same_delivery_address, message: 'Zadajte kam chcete zaslať hlasovací preukaz', + on: :delivery_address + validates_presence_of :delivery_street, message: 'Zadajte ulicu alebo názov obce ak obec nemá ulice', + on: [:delivery_address, :world_abroad_permanent_resident], + if: -> (f) { f.custom_delivery_address? } + validates_presence_of :delivery_pobox, message: 'Zadajte poštové smerové čislo', + on: [:delivery_address, :world_abroad_permanent_resident], + if: -> (f) { f.custom_delivery_address? } + validates_presence_of :delivery_municipality, message: 'Zadajte obec', + on: [:delivery_address, :world_abroad_permanent_resident], + if: -> (f) { f.custom_delivery_address? } + validates_presence_of :delivery_country, message: 'Zadajte štát', + on: [:delivery_address, :world_abroad_permanent_resident], + if: -> (f) { f.custom_delivery_address? } + + def self.active? + Date.current < FIRST_ROUND_DATE + 14.day + end + + def minv_email + "volby@minv.sk" + end + + def year + FIRST_ROUND_DATE.year + end + + def custom_delivery_address? + same_delivery_address == '0' || step == 'world_abroad_permanent_resident' + end + + def municipality_email_verified? + municipality_email_verified == "OK" + end + + def full_address + "#{street}, #{pobox} #{municipality}" + end + + def go_back? + back == "true" + end + + def place_choice + if place_first_round == 'sk' + if place_second_round == 'sk' + 'obe kolá' + else + 'prvé kolo' + end + else + 'druhé kolo' + end + end + + def pickup_remaining_days + if place_first_round == 'sk' + (FIRST_ROUND_DATE - Date.current).to_i - 1 + else + (FIRST_ROUND_DATE - Date.current).to_i + 13 + end + end + + def request_sending_remaining_days + if place_first_round == 'sk' + (FIRST_ROUND_REQUEST_SENDING_DEADLINE - Date.current).to_i + else + (SECOND_ROUND_REQUEST_SENDING_DEADLINE - Date.current).to_i + end + end + + def pickup_expired? + pickup_remaining_days < 0 + end + + def first_round_expired? + (FIRST_ROUND_DATE - Date.current).to_i < 0 + end + + def request_sending_expired? + request_sending_remaining_days < 0 + end + + def from_slovakia_email_body + ActionController::Base.new.render_to_string( + partial: "apps/president_vote_app/application_forms/from_slovakia_email_body", + locals: { model: self }, + ).gsub(/\n/, "\r\n") + end + + def from_slovakia_authorized_person_email_body + ActionController::Base.new.render_to_string( + partial: "apps/president_vote_app/application_forms/from_slovakia_authorized_person_email_body", + locals: { model: self }, + ).gsub(/\n/, "\r\n") + end + + private def pin_is_ok + return errors.add(:pin, 'Rodné číslo je pocinná položka') if pin.blank? + + begin + pin.to_i + rescue ArgumentError + return errors.add(:pin, 'Rodné číslo obsahuje neplatné znaky') + end + + pin = self.pin.gsub(%r{/}, '') + return errors.add(:pin, 'Rodné číslo nie je deliteľné číslom 11') if pin.length == 10 and pin.to_i % 11 != 0 + return errors.add(:pin, 'Rodné číslo má nesprávnu dĺžku') if pin.length != 10 and pin.length != 9 + + case pin[2..3].to_i + when 0, 13..50, 63..99 + return errors.add(:pin, 'Rodné číslo obsahuje neplatný mesiac') + end + + month = pin[2..3].to_i % 50 + year = pin[0..1].to_i + (pin[2..3].to_i > 12 ? 1900 : 2000) + begin + Date.new(year, month, pin[4..5].to_i) + rescue ArgumentError + errors.add(:pin, 'Rodné číslo obsahuje neplatný dátum') + end + end + + def run(listener) + case step + when 'start' + start_step(listener) + when 'place' + place_step(listener) + when 'sk_citizen' + sk_citizen_step(listener) + when 'permanent_resident' + permanent_resident_step(listener) + when 'delivery' + delivery_step(listener) + when 'identity' + identity_step(listener) + when 'authorized_person' + authorized_person_step(listener) + when 'address' + address_step(listener) + when 'delivery_address' + delivery_address_step(listener) + when 'world_abroad_permanent_resident' + world_abroad_permanent_resident_step(listener) + when 'non_sk_nationality' + non_sk_nationality(listener) + when 'home' + home(listener) + end + end + + private def start_step(listener) + self.step = 'sk_citizen' + listener.render :sk_citizen + end + + private def sk_citizen_step(listener) + if go_back? + self.step = 'start' + listener.render :start + elsif valid?(:sk_citizen) + case sk_citizen + when 'yes' + self.step = 'permanent_resident' + listener.render :permanent_resident + when 'no' + listener.redirect_to action: :non_sk_nationality + end + else + listener.render :sk_citizen + end + end + + private def permanent_resident_step(listener) + if go_back? + self.step = 'sk_citizen' + listener.render :sk_citizen + elsif valid?(:permanent_resident) + case permanent_resident + when 'yes' + self.step = 'place' + listener.render :place + when 'no' + listener.redirect_to action: :world + end + else + listener.render :permanent_resident + end + end + + private def place_step(listener) + if go_back? + self.step = 'permanent_resident' + listener.render :permanent_resident + elsif valid?(:place) + if first_round_expired? + if valid?(:place_second_round) + if place_second_round == 'sk' + self.place_first_round = 'home' + self.place_second_round = place_second_round + self.step = 'delivery' + listener.render :delivery + else + listener.redirect_to action: :home + end + else + listener.render :place + end + else + if place_first_round == 'sk' || place_second_round == 'sk' + self.place_first_round = place_first_round + self.place_second_round = place_second_round + self.step = 'delivery' + listener.render :delivery + else + listener.redirect_to action: :home + end + end + else + listener.render :place + end + end + + private def delivery_step(listener) + if go_back? + self.step = 'place' + listener.render :place + elsif valid?(:delivery) + case delivery + when 'post' + self.step = 'identity' + listener.render :identity + when 'authorized_person' + self.step = 'authorized_person' + listener.render :authorized_person + when 'person' + listener.redirect_to action: :person + end + else + listener.render :delivery + end + end + + private def identity_step(listener) + if go_back? + self.step = 'delivery' + listener.render :delivery + elsif valid?(:identity) + self.step = 'delivery_address' + listener.render :delivery_address + else + listener.render :identity + end + end + + private def delivery_address_step(listener) + if go_back? + self.step = 'identity' + listener.render :identity + elsif valid?(:delivery_address) + self.step = 'send' + listener.render :send + else + listener.render :delivery_address + end + end + + private def authorized_person_step(listener) + if go_back? + self.step = 'delivery' + listener.render :delivery + elsif valid?(:authorized_person) + self.step = 'authorized_person_send' + listener.render :authorized_person_send + else + self.step = 'authorized_person' + listener.render :authorized_person + end + end + + private def world_abroad_permanent_resident_step(listener) + if go_back? + self.step = 'permanent_resident' + listener.render :permanent_resident + else + listener.render :world_abroad_permanent_resident + end + end + + private def non_sk_nationality(listener) + if go_back? + self.step = 'sk_citizen' + listener.render :sk_citizen + else + listener.render :non_sk_nationality + end + end + + private def home(listener) + if go_back? + self.step = 'place' + listener.render :place + else + listener.render :home + end + end + end + end +end diff --git a/app/views/apps/parliament_vote_app/application_forms/_municipality_email_warning.html.erb b/app/views/apps/parliament_vote_app/application_forms/_municipality_email_warning.html.erb index 7d19577d..a22e3761 100644 --- a/app/views/apps/parliament_vote_app/application_forms/_municipality_email_warning.html.erb +++ b/app/views/apps/parliament_vote_app/application_forms/_municipality_email_warning.html.erb @@ -2,6 +2,6 @@ Upozornenie - <% unless @application_form.municipality_email_verified? %>Emailové adresy obcí je veľmi problematické získať a adresa tejto obce nebola ešte overená. <% end %>Uistite sa, či dostanete potvrdenie o prijatí žiadosti. Ak potvrdenie nedostanete, kontaktujte obec telefonicky alebo osobne. + Uistite sa, či dostanete potvrdenie o prijatí žiadosti. Ak potvrdenie nedostanete, kontaktujte obec telefonicky alebo osobne. diff --git a/app/views/apps/parliament_vote_app/application_forms/delivery.html.erb b/app/views/apps/parliament_vote_app/application_forms/delivery.html.erb index e5dba084..c12958e2 100644 --- a/app/views/apps/parliament_vote_app/application_forms/delivery.html.erb +++ b/app/views/apps/parliament_vote_app/application_forms/delivery.html.erb @@ -10,6 +10,7 @@ <%= render 'apps/parliament_vote_app/application_forms/subscribe' %> <% else %> <%= form_for @application_form, :builder => AppFormBuilder, url: request.original_url do |f| %> + <%= render 'apps/parliament_vote_app/application_forms/back', form: f %> <%= render 'components/error_summary', form: @application_form %> <%= f.hidden_field :step %> <%= f.hidden_field :sk_citizen %> diff --git a/app/views/apps/parliament_vote_app/application_forms/permanent_resident.erb b/app/views/apps/parliament_vote_app/application_forms/permanent_resident.erb index 05269977..f2ebf44d 100644 --- a/app/views/apps/parliament_vote_app/application_forms/permanent_resident.erb +++ b/app/views/apps/parliament_vote_app/application_forms/permanent_resident.erb @@ -4,6 +4,7 @@
<%= form_for @application_form, :builder => AppFormBuilder, url: request.original_url do |f| %> + <%= render 'apps/parliament_vote_app/application_forms/back', form: f %> <%= render 'components/error_summary', form: @application_form %> <%= f.hidden_field :step %> <%= f.radios :permanent_resident, 'Máte trvalý pobyt na Slovensku?' do %> diff --git a/app/views/apps/parliament_vote_app/application_forms/send.html.erb b/app/views/apps/parliament_vote_app/application_forms/send.html.erb index 0d0b0d6e..f559353e 100644 --- a/app/views/apps/parliament_vote_app/application_forms/send.html.erb +++ b/app/views/apps/parliament_vote_app/application_forms/send.html.erb @@ -3,28 +3,43 @@
-

Pošlite žiadosť na úrad

+

Pošlite email so žiadosťou na úrad

<% if @application_form.municipality_email.present? %> -

Otvorte - <%= mail_to @application_form.municipality_email, 'pripravenú žiadosť v emailovom klientovi'.html_safe, +

Vygenorovanú žiadosť potrebujete poslať z Vašej emailovej adresy na príslušnú adresu obce: + <%= mail_to @application_form.municipality_email, @application_form.municipality_email, target: '_blank', body: @application_form.from_slovakia_email_body, subject: 'Žiadosť o hlasovací preukaz do parlamentných volieb.' %> - alebo ju manuálne skopírujte a odošlite na emailovú adresu obce: - <%= mail_to @application_form.municipality_email, @application_form.municipality_email %>

<% else %> -

Skopírujte text žiadosti a pošlite ho na emailovú adresu obce.

+

Vygenorovanú žiadosť potrebujete poslať z Vašej emailovej adresy na príslušnú emailovú adresu obce + <%= @application_form.municipality %>

+

Emailovú adresu je možné nájsť na webovej stránke obce.

<% end %>
+ + <%= render 'municipality_email_warning' %> +
- +
+ - <%= render 'municipality_email_warning' %> +
+ <% if @application_form.municipality_email.present? %> + <%= button_tag 'Skopírovať text', class: 'govuk-button light-button', onclick: 'myFunction("emailContent")' %> + <% end %> +
@@ -32,7 +47,7 @@
<%= form_with url: end_apps_parliament_vote_app_application_forms_url, method: :get, local: true do |form| %> - <%= form.submit 'Pokračovať', id: 'nextButton', class: 'govuk-button govuk-!-margin-top-5', disabled: true %> + <%= form.submit 'Dokončiť návod', id: 'nextButton', class: 'govuk-button govuk-!-margin-top-5', disabled: true %> <% end %>
diff --git a/app/views/apps/parliament_vote_app/application_forms/sk_citizen.html.erb b/app/views/apps/parliament_vote_app/application_forms/sk_citizen.html.erb index 37355fa2..e00a87aa 100644 --- a/app/views/apps/parliament_vote_app/application_forms/sk_citizen.html.erb +++ b/app/views/apps/parliament_vote_app/application_forms/sk_citizen.html.erb @@ -4,6 +4,7 @@
<%= form_for @application_form, :builder => AppFormBuilder, url: request.original_url do |f| %> + <%= render 'apps/parliament_vote_app/application_forms/back', form: f %> <%= render 'components/error_summary', form: @application_form %> <%= f.hidden_field :step %> <%= f.radios :sk_citizen, 'Ste občan Slovenskej republiky?', inline: true do %> diff --git a/app/views/apps/president_vote_app/application_forms/_back.html.erb b/app/views/apps/president_vote_app/application_forms/_back.html.erb new file mode 100644 index 00000000..c63978c5 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/_back.html.erb @@ -0,0 +1,9 @@ + +<%= form.hidden_field :back, value: false %> + diff --git a/app/views/apps/president_vote_app/application_forms/_from_slovakia_authorized_person_email_body.text.erb b/app/views/apps/president_vote_app/application_forms/_from_slovakia_authorized_person_email_body.text.erb new file mode 100644 index 00000000..0ac047dc --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/_from_slovakia_authorized_person_email_body.text.erb @@ -0,0 +1,19 @@ +Dobrý deň, + +týmto žiadam o vydanie hlasovacieho preukazu pre voľby prezidenta Slovenskej republiky. Žiadam o vydanie preukazu pre <%= model.place_choice %> volieb. + +Moje identifikačné údaje sú: + +Meno: <%= model.full_name %> +Rodné číslo: <%= model.pin %> +Trvalý pobyt: <%= model.street %>, <%= model.pobox%> <%= model.municipality %> +Štátna príslušnosť: slovenská + +Preukaz vyzdvihne splnomocnená osoba: + +Meno: <%= model.authorized_person_full_name %> +Číslo občianskeho preukazu: <%= model.authorized_person_pin %> + +Zároveň žiadam o zaslanie potvrdenia, že ste túto žiadosť prijali. + +Ďakujem. diff --git a/app/views/apps/president_vote_app/application_forms/_from_slovakia_email_body.text.erb b/app/views/apps/president_vote_app/application_forms/_from_slovakia_email_body.text.erb new file mode 100644 index 00000000..ddad751b --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/_from_slovakia_email_body.text.erb @@ -0,0 +1,21 @@ +Dobrý deň, + +týmto žiadam o vydanie hlasovacieho preukazu pre voľby prezidenta Slovenskej republiky. Žiadam o vydanie preukazu pre <%= model.place_choice %> volieb. + +Moje identifikačné údaje sú: + +Meno: <%= model.full_name %> +Rodné číslo: <%= model.pin %> +Trvalý pobyt: <%= model.street %>, <%= model.pobox%> <%= model.municipality %> +Štátna príslušnosť: slovenská + +<% unless model.custom_delivery_address? %> +Preukaz prosím zaslať na adresu trvalého pobytu. +<% else %> +Preukaz prosím zaslať na korešpondenčnú adresu: +<%= model.delivery_street %>, <%= model.delivery_pobox %> <%= model.delivery_municipality %>, <%= model.delivery_country %> +<% end %> + +Zároveň žiadam o zaslanie potvrdenia, že ste túto žiadosť prijali. + +Ďakujem. diff --git a/app/views/apps/president_vote_app/application_forms/_municipality_ui.html.erb b/app/views/apps/president_vote_app/application_forms/_municipality_ui.html.erb new file mode 100644 index 00000000..693744d3 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/_municipality_ui.html.erb @@ -0,0 +1,236 @@ + + +<%= stylesheet_link_tag 'accessible-autocomplete', media: 'all', 'data-turbolinks-track': 'reload' %> +<%= javascript_include_tag 'apps/ep_vote_app/libs.js', 'data-turbolinks-track': 'reload' %> + diff --git a/app/views/apps/president_vote_app/application_forms/_next_vote_notifications.html.erb b/app/views/apps/president_vote_app/application_forms/_next_vote_notifications.html.erb new file mode 100644 index 00000000..78c36270 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/_next_vote_notifications.html.erb @@ -0,0 +1,7 @@ +<%= render_notification_subscription_component ['NextVoteSubscription', 'NewsletterSubscription'] do %> +

Aktivujte si notifikácie na email, aby Vám už žiaden dôležitý termín neunikol.

+<% end %> +

Čo ďalej?

+

Ak sa vám táto aplikácia páčila, môžete sa zapojiť a pomôcť nám s vývojom či obsahom, alebo nás <%= link_to 'podporte finančne', 'https://slovensko.digital/podpora' %>.

+

Na portáli Návody.Digital nájdete <%= link_to 'množstvo ďalších návodov', root_path %> ako vyriešiť aj iné životné situácie, ktoré si vyžadujú kontakt so štátnou byrokraciou.

+ diff --git a/app/views/apps/president_vote_app/application_forms/_subscribe.html.erb b/app/views/apps/president_vote_app/application_forms/_subscribe.html.erb new file mode 100644 index 00000000..68e21097 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/_subscribe.html.erb @@ -0,0 +1,3 @@ +<%= render_notification_subscription_component ['VoteSubscription', 'NewsletterSubscription'] do %> +

Aktivujte si aj upozornenia na email, aby ste na nič nezabudli.

+<% end %> diff --git a/app/views/apps/president_vote_app/application_forms/authorized_person.html.erb b/app/views/apps/president_vote_app/application_forms/authorized_person.html.erb new file mode 100644 index 00000000..ea1e40c3 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/authorized_person.html.erb @@ -0,0 +1,36 @@ +<%= content_for :title, build_page_title('Osobné prevzatie hlasovacieho preukazu', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+ <%= form_for @application_form, :builder => AppFormBuilder, url: request.original_url do |f| %> + <%= render 'apps/president_vote_app/application_forms/back', form: f %> + <%= render 'components/error_summary', form: @application_form %> +

Prevzatie hlasovacieho preukazu splnomocnenou osobou

+

Vaše osobné údaje

+ <%= f.hidden_field :step %> + <%= f.hidden_field :municipality_email %> + <%= f.hidden_field :municipality_email_verified %> + <%= f.hidden_field :place_first_round %> + <%= f.hidden_field :place_second_round %> + + <%= f.text_field :full_name, class: 'govuk-input--width-20 person', label: 'Meno, priezvisko, titul', hint: 'Ako na občianskom preukaze. Napríklad: JUDr. Ján Mrkvička', autocomplete: 'name' %> + <%= f.text_field :pin, class: 'govuk-input--width-10 person', label: 'Rodné číslo', hint: 'Napríklad: 123456/1234' %> + +
+

Adresa trvalého pobytu

+ <%= f.text_field :street, label: 'Ulica a číslo', hint: 'Napríklad: Kaštieľska 2', class: 'govuk-input--width-20', 'autocomplete': 'address-line1' %> + <%= f.text_field :pobox, label: 'PSČ', hint: 'Napríklad: 841 01', class: 'govuk-input--width-5', 'autocomplete': 'postal-code' %> + <%= f.text_field :municipality, label: 'Obec', class: 'govuk-input--width-20 input-to-replace' %> + +
+

Splnomocnená osoba

+ <%= f.text_field :authorized_person_full_name, class: 'govuk-input--width-20 authorized-person', label: 'Meno, priezvisko, titul', hint: 'Ako na občianskom preukaze. Napríklad: JUDr. Ján Mrkvička', autocomplete: 'name' %> + <%= f.text_field :authorized_person_pin, class: 'govuk-input--width-10 authorized-person', label: 'Číslo občianskeho preukazu', hint: 'Napríklad: EP123456' %> + + <%= f.submit 'Pokračovať'%> + <% end %> +
+
+ +<%= render "apps/president_vote_app/application_forms/municipality_ui" %> diff --git a/app/views/apps/president_vote_app/application_forms/authorized_person_send.html.erb b/app/views/apps/president_vote_app/application_forms/authorized_person_send.html.erb new file mode 100644 index 00000000..e47ae8a5 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/authorized_person_send.html.erb @@ -0,0 +1,62 @@ +<%= content_for :title, build_page_title('Zaslanie žiadosti', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+ <%= form_for @application_form, :builder => AppFormBuilder, url: request.original_url do |f| %> + <%= render 'apps/president_vote_app/application_forms/back', form: f %> + <%= f.hidden_field :step %> + <% end %> + +

Pošlite email so žiadosťou na úrad

+ +
+ <% if @application_form.municipality_email.present? %> +

Vygenorovanú žiadosť potrebujete poslať z Vašej emailovej adresy na príslušnú adresu obce: + <%= mail_to @application_form.municipality_email, @application_form.municipality_email, + target: '_blank', + body: @application_form.from_slovakia_authorized_person_email_body, + subject: 'Žiadosť o hlasovací preukaz do prezidentských volieb.' + %> +

+ <% else %> +

Vygenorovanú žiadosť potrebujete poslať z Vašej emailovej adresy na príslušnú emailovú adresu obce + <%= @application_form.municipality %>

+

Emailovú adresu je možné nájsť na webovej stránke obce.

+ <% end %> +
+ +
+ +
+ + +
+ <%= button_tag 'Skopírovať text', class: 'govuk-button light-button', onclick: 'copyToClipboard("emailContent")' %> +
+ +
+ + + Upozornenie + Na odoslanie zostáva ešte <%= format_remaining_days_count(@application_form.request_sending_remaining_days) %>. + +
+ +
+ + +
+ + <%= form_with url: end_apps_president_vote_app_application_forms_url, method: :get, local: true do |form| %> + <%= form.submit 'Dokončiť návod', id: 'nextButton', class: 'govuk-button govuk-!-margin-top-5', disabled: true %> + <% end %> +
+
diff --git a/app/views/apps/president_vote_app/application_forms/delivery.html.erb b/app/views/apps/president_vote_app/application_forms/delivery.html.erb new file mode 100644 index 00000000..65f8e6a8 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/delivery.html.erb @@ -0,0 +1,58 @@ +<%= content_for :title, build_page_title('Hlasovací preukaz', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+

+ Potrebujete požiadať o hlasovací preukaz pre <%= @application_form.place_choice %> volieb +

+

Aby ste mohli v deň volieb voliť mimo vášho trvalého bydliska, musíte požiadať vašu obec o vydanie hlasovacieho preukazu – osobne alebo elektronicky. Hlasovací preukaz vás oprávňuje voliť z ktoréhokoľvek volebného okrsku v SR.

+ <% if false %> +

Obce potrebné informácie k žiadostiam v súčastnosti ešte len zverejňujú, ak nám však necháte email, dáme Vám vedieť, keď už bude možné o hlasovací preukaz požiadať. Posledný termín na zaslanie žiadosti je 8. septembra.

+ <%= render 'apps/president_vote_app/application_forms/subscribe' %> + <% else %> + <%= form_for @application_form, :builder => AppFormBuilder, url: request.original_url do |f| %> + <%= render 'apps/president_vote_app/application_forms/back', form: f %> + <%= render 'components/error_summary', form: @application_form %> + <%= f.hidden_field :step %> + <%= f.hidden_field :sk_citizen %> + <%= f.hidden_field :place_first_round %> + <%= f.hidden_field :place_second_round %> +
+

+ Ako prevezmete hlasovací preukaz? +

+ <%= f.error_message :delivery %> + +
+ <%= f.radio_button :delivery, 'post', + label: "Nechám si ho poslať poštou", + disabled: @application_form.request_sending_expired?, + hint: @application_form.request_sending_expired? ? + "Termín na zaslanie žiadosti o hlasovací preukaz už uplynul." : + "O hlasovací preukaz môžete požiadať elektronicky (emailom) a bude vám doručený na adresu uvedenú v žiadosti. #{format_remaining_days(@application_form.request_sending_remaining_days)}", + strong_label: true + %> + <%= f.radio_button :delivery, 'authorized_person', + label: "Vyzdvihne ho za mňa iná osoba", + disabled: @application_form.request_sending_expired?, + hint: @application_form.request_sending_expired? ? + "Termín na zaslanie žiadosti o hlasovací preukaz už uplynul." : + "Hlasovací preukaz za vás môže vyzdvihnúť aj iná osoba, ktorú uvediete v žiadosti. #{format_remaining_days(@application_form.request_sending_remaining_days)}", + strong_label: true + %> + <%= f.radio_button :delivery, 'person', + label: "Vyzdvihnem ho osobne na úrade", + disabled: @application_form.pickup_expired?, + hint: @application_form.pickup_expired? ? + "Termín na vyzdvihnutie hlasovacieho preukazu už uplynul." : + "O hlasovací preukaz môžete požiadať osobne najneskôr posledný pracovný deň pred konaním volieb v úradných hodinách obce. Hlasovací preukaz vám vystavia na počkanie. #{format_remaining_days(@application_form.pickup_remaining_days)}", + strong_label: true + %> +
+
+ <%= submit_tag 'Pokračovať', class: 'govuk-button' %> + <% end %> + <% end %> +
+
diff --git a/app/views/apps/president_vote_app/application_forms/delivery_address.html.erb b/app/views/apps/president_vote_app/application_forms/delivery_address.html.erb new file mode 100644 index 00000000..4bf27233 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/delivery_address.html.erb @@ -0,0 +1,41 @@ +<%= content_for :title, build_page_title('Spôsob prevzatia hlasovacieho preukazu', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+ <%= form_for @application_form, :builder => AppFormBuilder, url: request.original_url do |f| %> + <%= render 'apps/president_vote_app/application_forms/back', form: f %> + <%= render 'components/error_summary', form: @application_form %> + <%= f.hidden_field :step %> + <%= f.hidden_field :full_name %> + <%= f.hidden_field :pin %> + <%= f.hidden_field :street %> + <%= f.hidden_field :pobox %> + <%= f.hidden_field :municipality %> + <%= f.hidden_field :municipality_email %> + <%= f.hidden_field :municipality_email_verified %> + <%= f.hidden_field :place_first_round %> + <%= f.hidden_field :place_second_round %> + +

Kam chcete zaslať hlasovací preukaz?

+ +
+ <%= f.error_message :same_delivery_address %> + +
+ <%= f.radio_button :same_delivery_address, '1', label: "Na adresu trvalého bydliska", hint: @application_form.full_address%> + <%= f.radio_button :same_delivery_address, '0', label: "Na inú adresu", data: {'aria-controls' => 'conditional-delivery-address'}%> + +
+ <%= f.text_field :delivery_street, label: 'Ulica a číslo', hint: 'Napríklad: Kaštieľska 2', class: 'govuk-input--width-20', 'autocomplete': 'address-line1' %> + <%= f.text_field :delivery_pobox, label: 'PSČ', hint: 'Napríklad: 841 01', class: 'govuk-input--width-5', 'autocomplete': 'postal-code' %> + <%= f.text_field :delivery_municipality, label: 'Obec', class: 'govuk-input--width-10', 'autocomplete': 'address-level2' %> + <%= f.text_field :delivery_country, label: 'Štát', class: 'govuk-input--width-10', 'autocomplete': 'country-name' %> +
+
+
+ + <%= f.submit 'Pokračovať' %> + <% end %> +
+
diff --git a/app/views/apps/president_vote_app/application_forms/end.html.erb b/app/views/apps/president_vote_app/application_forms/end.html.erb new file mode 100644 index 00000000..059c1491 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/end.html.erb @@ -0,0 +1,25 @@ +<%= content_for :title, build_page_title('Notifikácie', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+

Počkajte na hlasovací preukaz

+

Nezabudnite voliť a voľte zodpovedne.

+

Ak ste odoslali žiadosť na úrad, do 3 dní by ste mali od obce dostať potvrdenie o prijatí.

+

Volebný preukaz si so sebou musíte vziať, aj keď sa nakoniec rozhodnete voliť v mieste trvalého bydliska.

+ +
+ + + Upozornenie + Ak vám do 3 dní nepríde potvrdenie o prijatí žiadosti, kontaktujte obec telefonicky alebo osobne. + +
+
+
+ +
+
+ <%= render 'apps/president_vote_app/application_forms/subscribe' %> +
+
diff --git a/app/views/apps/president_vote_app/application_forms/home.html.erb b/app/views/apps/president_vote_app/application_forms/home.html.erb new file mode 100644 index 00000000..f4b21dc0 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/home.html.erb @@ -0,0 +1,16 @@ +<%= content_for :title, build_page_title('Hlasovanie v mieste trvalého bydliska', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+ <%= form_for 'apps_president_vote_app_application_form', :builder => AppFormBuilder, url: apps_president_vote_app_application_forms_path do |f| %> + <%= render 'apps/president_vote_app/application_forms/back', form: f %> + <%= f.hidden_field :step, :value => 'home' %> + <% end %> + +

Nepotrebujete nič vybavovať

+

V čase volieb volíte vo volebnom okrsku, v ktorom ste zapísaný podľa miesta vášho trvalého bydliska.

+

O volebnom okrsku informuje obec v oznámení o čase a miesta konania volieb. V deň konania volieb si nezabudnite do volebnej miestnosti priniesť občiansky preukaz.

+ <%= render 'apps/president_vote_app/application_forms/subscribe' %> +
+
diff --git a/app/views/apps/president_vote_app/application_forms/identity.html.erb b/app/views/apps/president_vote_app/application_forms/identity.html.erb new file mode 100644 index 00000000..dd4c107e --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/identity.html.erb @@ -0,0 +1,31 @@ +<%= content_for :title, build_page_title('Osobné údaje', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+ <%= form_for @application_form, :builder => AppFormBuilder, url: request.original_url do |f| %> + <%= render 'apps/president_vote_app/application_forms/back', form: f %> + <%= render 'components/error_summary', form: @application_form %> + +

Vaše osobné údaje

+ <%= f.hidden_field :step %> + <%= f.hidden_field :municipality_email %> + <%= f.hidden_field :municipality_email_verified %> + <%= f.hidden_field :place_first_round %> + <%= f.hidden_field :place_second_round %> + + <%= f.text_field :full_name, class: 'govuk-input--width-20', label: 'Meno, priezvisko, titul', hint: 'Ako na občianskom preukaze. Napríklad: JUDr. Ján Mrvička', autocomplete: 'name' %> + <%= f.text_field :pin, class: 'govuk-input--width-10', label: 'Rodné číslo', hint: 'Napríklad: 123456/1234' %> + +
+

Adresa trvalého pobytu

+ <%= f.text_field :street, label: 'Ulica a číslo', hint: 'Napríklad: Kaštieľska 2', class: 'govuk-input--width-20', 'autocomplete': 'address-line1' %> + <%= f.text_field :pobox, label: 'PSČ', hint: 'Napríklad: 841 01', class: 'govuk-input--width-5', 'autocomplete': 'postal-code' %> + <%= f.text_field :municipality, label: 'Obec', class: 'govuk-input--width-20 input-to-replace' %> + + <%= f.submit 'Pokračovať'%> + <% end %> +
+
+ +<%= render "apps/president_vote_app/application_forms/municipality_ui" %> diff --git a/app/views/apps/president_vote_app/application_forms/inactive.html.erb b/app/views/apps/president_vote_app/application_forms/inactive.html.erb new file mode 100644 index 00000000..914a5514 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/inactive.html.erb @@ -0,0 +1,8 @@ +<%= content_for :title, build_page_title('Prezidentské voľby') %> + +
+
+

Prezidentské voľby sa už konali

+ <%= render 'apps/president_vote_app/application_forms/subscribe' %> +
+
diff --git a/app/views/apps/president_vote_app/application_forms/non_sk_nationality.html.erb b/app/views/apps/president_vote_app/application_forms/non_sk_nationality.html.erb new file mode 100644 index 00000000..36409645 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/non_sk_nationality.html.erb @@ -0,0 +1,18 @@ +<%= content_for :title, build_page_title('V prezidentských voľbách nemôžete voliť', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+ <%= form_for 'apps_president_vote_app_application_form', :builder => AppFormBuilder, url: apps_president_vote_app_application_forms_path do |f| %> + <%= render 'apps/president_vote_app/application_forms/back', form: f %> + <%= f.hidden_field :step, :value => "non_sk_nationality" %> + <% end %> + +

V prezidentských voľbách nemôžete voliť

+

+ Vo voľbách prezidenta Slovenskej republiky (prezidentské voľby) môžu voliť len občania Slovenskej republiky. +

+ + <%= render 'apps/president_vote_app/application_forms/subscribe' %> +
+
diff --git a/app/views/apps/president_vote_app/application_forms/permanent_resident.erb b/app/views/apps/president_vote_app/application_forms/permanent_resident.erb new file mode 100644 index 00000000..9f7d0115 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/permanent_resident.erb @@ -0,0 +1,22 @@ +<%= content_for :title, build_page_title('Miesto voľby', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+ <%= form_for @application_form, :builder => AppFormBuilder, url: request.original_url do |f| %> + <%= render 'apps/president_vote_app/application_forms/back', form: f %> + <%= render 'components/error_summary', form: @application_form %> + <%= f.hidden_field :step %> + <%= f.radios :permanent_resident, 'Máte trvalý pobyt na Slovensku?' do %> +

Na to aby ste nemali trvalý pobyt na Slovensku, museli ste si ho odhlásiť.

+ <%= f.radio_button :permanent_resident, 'yes', label: "Áno" %> + <%= f.radio_button :permanent_resident, 'no', + label: "Nie, mám odhlásený trvalý pobyt zo Slovenska", + hint: "Pri odhlasovaní trvalého pobytu sa odovzdáva občiansky preukaz. Ak ste ho odovzdali, zvoľte túto možnosť." + %> + <% end %> + + <%= f.submit 'Pokračovať' %> + <% end %> +
+
diff --git a/app/views/apps/president_vote_app/application_forms/person.html.erb b/app/views/apps/president_vote_app/application_forms/person.html.erb new file mode 100644 index 00000000..d49f9402 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/person.html.erb @@ -0,0 +1,10 @@ +<%= content_for :title, build_page_title('Osobné prevzatie hlasovacieho preukazu', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+

Prevzatie hlasovacieho preukazu osobne

+

Hlasovací preukaz vám vystavia na počkanie na obecnom úrade v mieste trvalého bydliska. Osobne si preukaz vybavíte najneskôr v posledný pracovný deň pred voľbami, počas pracovných hodín úradu.

+ <%= render 'apps/president_vote_app/application_forms/subscribe' %> +
+
diff --git a/app/views/apps/president_vote_app/application_forms/place.html.erb b/app/views/apps/president_vote_app/application_forms/place.html.erb new file mode 100644 index 00000000..f61793ea --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/place.html.erb @@ -0,0 +1,40 @@ +<%= content_for :title, build_page_title('Miesto voľby', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+ <%= form_for @application_form, :builder => AppFormBuilder do |f| %> + <%= render 'apps/president_vote_app/application_forms/back', form: f %> + <%= render 'components/error_summary', form: @application_form %> + <%= f.hidden_field :step %> + <% if @application_form.first_round_expired? %> + <% hint = 'Druhé kolo prezidentských volieb sa na Slovensku koná 6. apríla od 7:00 do 22:00. Hlasovať je možné jedine osobne na území Slovenska.' %> + <%= f.radios :place, 'Kde plánujete ísť voliť?', hint: hint do %> +

1. kolo

+ <%= f.hidden_field :place_first_round, :value => 'home' %> +

+ Prvé kolo sa už konalo +

+

2. kolo

+ <%= f.radio_button :place_second_round, 'sk', label: "Mimo trvalého bydliska" %> + <%= f.radio_button :place_second_round, 'home', label: "V mieste trvalého bydliska" %> + <% end %> + + <%= f.submit 'Pokračovať' %> + <% else %> + <% hint = 'Prezidentské voľby sa na Slovensku konajú od 7:00 do 22:00. Zvoľte, či budete hlasovať mimo trvalého bydliska v prvom, druhom, alebo v oboch kolách.' %> + <%= f.radios :place, 'V ktorých kolách plánujete hlasovať mimo trvalého bydliska?', hint: hint do %> +
+ + +
+
+ + +
+ <%= f.submit 'Pokračovať' %> + <% end %> + <% end %> + <% end %> +
+
diff --git a/app/views/apps/president_vote_app/application_forms/send.html.erb b/app/views/apps/president_vote_app/application_forms/send.html.erb new file mode 100644 index 00000000..a6a09836 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/send.html.erb @@ -0,0 +1,57 @@ +<%= content_for :title, build_page_title('Zaslanie žiadosti', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+

Pošlite email so žiadosťou na úrad

+ +
+ <% if @application_form.municipality_email.present? %> +

Vygenerovanú žiadosť potrebujete poslať z Vašej emailovej adresy na príslušnú adresu obce: + <%= mail_to @application_form.municipality_email, @application_form.municipality_email, + target: '_blank', + body: @application_form.from_slovakia_email_body, + subject: 'Žiadosť o hlasovací preukaz do prezidentských volieb.' + %> +

+ <% else %> +

Vygenerovanú žiadosť potrebujete poslať z Vašej emailovej adresy na príslušnú emailovú adresu obce + <%= @application_form.municipality %>

+

Emailovú adresu je možné nájsť na webovej stránke obce.

+ <% end %> +
+ +
+ +
+ + +
+ <%= button_tag 'Skopírovať text', class: 'govuk-button light-button', onclick: 'copyToClipboard("emailContent")' %> +
+ +
+ + + Upozornenie + Na odoslanie zostáva ešte <%= format_remaining_days_count(@application_form.request_sending_remaining_days) %>. + +
+ +
+ + +
+ + <%= form_with url: end_apps_president_vote_app_application_forms_url, method: :get, local: true do |form| %> + <%= form.submit 'Dokončiť návod', id: 'nextButton', class: 'govuk-button govuk-!-margin-top-5', disabled: true %> + <% end %> +
+
diff --git a/app/views/apps/president_vote_app/application_forms/sk_citizen.html.erb b/app/views/apps/president_vote_app/application_forms/sk_citizen.html.erb new file mode 100644 index 00000000..385f2b5f --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/sk_citizen.html.erb @@ -0,0 +1,18 @@ +<%= content_for :title, build_page_title('Ste občan SR?', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+ <%= form_for @application_form, :builder => AppFormBuilder, url: request.original_url do |f| %> + <%= render 'apps/president_vote_app/application_forms/back', form: f %> + <%= render 'components/error_summary', form: @application_form %> + <%= f.hidden_field :step %> + <%= f.radios :sk_citizen, 'Ste občan Slovenskej republiky?', inline: true do %> + <%= f.radio_button :sk_citizen, 'yes', label: "Áno" %> + <%= f.radio_button :sk_citizen, 'no', label: "Nie" %> + <% end %> + + <%= f.submit 'Pokračovať' %> + <% end %> +
+
diff --git a/app/views/apps/president_vote_app/application_forms/start.html.erb b/app/views/apps/president_vote_app/application_forms/start.html.erb new file mode 100644 index 00000000..a079bbea --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/start.html.erb @@ -0,0 +1,17 @@ +<%= content_for :title, build_page_title('Prezidentské voľby') %> + +
+
+

Prezidentské voľby

+

Prezidentské voľby na Slovensku budú 23. marca a prípadné druhé kolo 6. apríla 2024. Hlasovať je možné jedine osobne na území Slovenska.

+

Ak budete počas volieb mimo trvalého bydliska, táto služba vám pomôže vytvoriť žiadosť o hlasovací preukaz tak, aby ste na nič dôležité nezabudli. Je to veľmi jednoduché a trvá to len pár minút.

+

O hlasovací preukaz môžete požiadať osobne na úrade pre prvé kolo ešte do 22. marca a pre druhé kolo do 5. apríla.

+

Používaním tejto služby súhlasíte so spracovaním osobných údajov v rozsahu nevyhnutnom pre určenie spôsobu voľby a vytvorenie žiadosti o hlasovací preukaz. Následne sú všetky údaje nenávratne zmazané.

+ <%= form_for @application_form do |f| %> +
+ <%= f.hidden_field :step %> +
+ <%= submit_tag 'Súhlasím a chcem začať', class: 'govuk-button govuk-button--large' %> + <% end %> +
+
diff --git a/app/views/apps/president_vote_app/application_forms/world.html.erb b/app/views/apps/president_vote_app/application_forms/world.html.erb new file mode 100644 index 00000000..381e9486 --- /dev/null +++ b/app/views/apps/president_vote_app/application_forms/world.html.erb @@ -0,0 +1,20 @@ +<%= content_for :title, build_page_title('Hlasovanie bez trvalého pobytu', 'Prezidentské voľby') %> +<%= content_for(:headerline, 'Prezidentské voľby') %> + +
+
+ <%= form_for 'apps_president_vote_app_application_form', :builder => AppFormBuilder, url: apps_president_vote_app_application_forms_path do |f| %> + <%= render 'apps/president_vote_app/application_forms/back', form: f %> + <%= f.hidden_field :step, :value => 'world_abroad_permanent_resident' %> + <% end %> + +

Ak máte odhlásený trvalý pobyt, môžete voliť v ktoromkoľvek volebnom okrsku na Slovensku

+

Ak nemáte trvalý pobyt na Slovensku, môžete prísť voliť kdekoľvek na území Slovenska. Potrebujete sa preukázať slovenským pasom.

+

Okrsková volebná komisia takéhoto voliča dopíše do zoznamu voličov, čo zaznamená v jeho slovenskom cestovnom doklade a poskytne mu na podpis čestné vyhlásenie o trvalom pobyte v cudzine, ktoré pripojí k zoznamu voličov.

+
+
+
+
+ <%= render 'apps/president_vote_app/application_forms/subscribe' %> +
+
diff --git a/config/routes.rb b/config/routes.rb index eaa97608..c4c46b57 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -96,6 +96,20 @@ end end + if ENV['DISABLED_FEATURES'].to_s.exclude?('president_vote_app') + namespace :president_vote_app, path: 'prezidentske-volby' do + resource :application_forms, path: '' do + member do + get :end, path: 'volte-zodpovedne' + get :home, path: 'hlasovanie-v-mieste-trvaleho-bydliska' + get :world, path: 'hlasovanie-cestovny-doklad' + get :person, path: 'hlasovaci-preukaz-osobne' + get :non_sk_nationality, path: 'hlasovanie-neobcana' + end + end + end + end + namespace :child_birth_app, path: 'narodenie-dietata' do get :picking_up_protocol, to: 'picking_up_protocol#show', path: 'vyzdvihnutie-rodneho-listu' end diff --git a/spec/features/apps/parliament_vote_app_spec.rb b/spec/features/apps/parliament_vote_app_spec.rb index f1f335ea..c9fd624c 100644 --- a/spec/features/apps/parliament_vote_app_spec.rb +++ b/spec/features/apps/parliament_vote_app_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -require_relative '../../../app/models/apps/ep_vote_app/application_form' +require_relative '../../../app/models/apps/parliament_vote_app/application_form' -def start +def start_parliament_vote_app visit apps_parliament_vote_app_application_forms_path click_button 'Súhlasím a chcem začať' end @@ -12,7 +12,7 @@ def start end scenario 'As a citizen I want to vote in a different voting district' do - start + start_parliament_vote_app choose 'Áno' click_button 'Pokračovať' @@ -33,7 +33,7 @@ def start scenario 'As a citizen I want to request voting permit personally after the deadline' do travel_to Apps::ParliamentVoteApp::ApplicationForm::PICKUP_DEADLINE_DATE + 1.day - start + start_parliament_vote_app choose 'Áno' click_button 'Pokračovať' @@ -48,7 +48,7 @@ def start scenario 'As a citizen I want to request voting permit by authorized person after the deadline' do travel_to Apps::ParliamentVoteApp::ApplicationForm::PICKUP_DEADLINE_DATE + 1.day - start + start_parliament_vote_app choose 'Áno' click_button 'Pokračovať' @@ -63,7 +63,7 @@ def start scenario 'As a citizen I want to request voting permit by post after the deadline' do travel_to Apps::ParliamentVoteApp::ApplicationForm::DELIVERY_BY_POST_DEADLINE_DATE + 1.day - start + start_parliament_vote_app choose 'Áno' click_button 'Pokračovať' @@ -78,7 +78,7 @@ def start scenario 'As a pernament citizen with I want to vote by post after the deadline' do travel_to Apps::ParliamentVoteApp::ApplicationForm::VOTE_BY_POST_DEADLINE_DATE + 1.day - start + start_parliament_vote_app choose 'Áno' click_button 'Pokračovať' @@ -93,7 +93,7 @@ def start scenario 'As a abroad citizen I want to vote by post after the deadline' do travel_to Apps::ParliamentVoteApp::ApplicationForm::VOTE_BY_POST_DEADLINE_DATE + 1.day - start + start_parliament_vote_app choose 'Áno' click_button 'Pokračovať' @@ -104,7 +104,7 @@ def start end scenario 'As a citizen I want to request voting permit personally' do - start + start_parliament_vote_app choose 'Áno' click_button 'Pokračovať' @@ -121,7 +121,7 @@ def start end scenario 'As a citizen I want to request voting permit via authorized person' do - start + start_parliament_vote_app choose 'Áno' click_button 'Pokračovať' @@ -135,7 +135,7 @@ def start click_button 'Pokračovať' fill_in 'Meno, priezvisko, titul', with: 'Ferko Mrkva', class: 'person' - fill_in 'Rodné číslo', with: '123', class: 'person' + fill_in 'Rodné číslo', with: '600101/1973', class: 'person' fill_in 'Ulica', with: 'Pupavova 31' fill_in 'PSČ', with: '456' fill_in 'Obec', with: 'Bratislava - Karlova ves' @@ -144,7 +144,7 @@ def start click_button 'Pokračovať' expect(page).to have_content('Meno: Ferko Mrkva') - expect(page).to have_content('Rodné číslo: 123') + expect(page).to have_content('Rodné číslo: 600101/1973') expect(page).to have_content('Trvalý pobyt: Pupavova 31, 456 Bratislava - Karlova ves') expect(page).to have_content("Preukaz vyzdvihne splnomocnená osoba:\r \r Meno: Jarko Mrkva\r Číslo občianskeho preukazu: 567") @@ -152,7 +152,7 @@ def start end scenario 'As a citizen I want to vote at home address' do - start + start_parliament_vote_app choose 'Áno' click_button 'Pokračovať' @@ -166,7 +166,7 @@ def start end scenario 'As a citizen I want to vote in foregin country with permanent residency in Slovakia' do - start + start_parliament_vote_app choose 'Áno' click_button 'Pokračovať' @@ -184,7 +184,7 @@ def start end scenario 'As a citizen I want to vote in foregin country with permanent residency outside Slovakia' do - start + start_parliament_vote_app choose 'Áno' click_button 'Pokračovať' @@ -199,7 +199,7 @@ def start end scenario "As a non-SK citizen I can't vote in parliament votes" do - start + start_parliament_vote_app choose 'Nie' click_button 'Pokračovať' diff --git a/spec/features/apps/president_vote_app_spec.rb b/spec/features/apps/president_vote_app_spec.rb new file mode 100644 index 00000000..2f34c613 --- /dev/null +++ b/spec/features/apps/president_vote_app_spec.rb @@ -0,0 +1,220 @@ +require 'rails_helper' +require_relative '../../../app/models/apps/president_vote_app/application_form' + +def start + visit apps_president_vote_app_application_forms_path + click_button 'Súhlasím a chcem začať' +end + +RSpec.feature "President vote app", type: :feature do + before do + travel_to Apps::PresidentVoteApp::ApplicationForm::FIRST_ROUND_DATE - 2.months + end + + scenario 'As a citizen I want to vote in a different voting district in first round' do + start + + choose 'Áno' + click_button 'Pokračovať' + + choose 'Áno' + click_button 'Pokračovať' + + check 'apps_president_vote_app_application_form[place_first_round]' + click_button 'Pokračovať' + + expect(page).to have_content('Potrebujete požiadať o hlasovací preukaz pre prvé kolo volieb') + expect(page).to have_content('Aby ste mohli v deň volieb voliť mimo vášho trvalého bydliska, musíte požiadať vašu obec o vydanie hlasovacieho preukazu – osobne alebo elektronicky. Hlasovací preukaz vás oprávňuje voliť z ktoréhokoľvek volebného okrsku v SR.') + expect(page).to have_content('Ako prevezmete hlasovací preukaz?') + expect(page).to have_content('Nechám si ho poslať poštou') + expect(page).to have_content('Vyzdvihne ho za mňa iná osoba') + expect(page).to have_content('Vyzdvihnem ho osobne na úrade') + end + + scenario 'As a citizen I want to vote in a different voting district in second round' do + start + + choose 'Áno' + click_button 'Pokračovať' + + choose 'Áno' + click_button 'Pokračovať' + + check 'apps_president_vote_app_application_form[place_second_round]' + click_button 'Pokračovať' + + expect(page).to have_content('Potrebujete požiadať o hlasovací preukaz pre druhé kolo volieb') + expect(page).to have_content('Aby ste mohli v deň volieb voliť mimo vášho trvalého bydliska, musíte požiadať vašu obec o vydanie hlasovacieho preukazu – osobne alebo elektronicky. Hlasovací preukaz vás oprávňuje voliť z ktoréhokoľvek volebného okrsku v SR.') + expect(page).to have_content('Ako prevezmete hlasovací preukaz?') + expect(page).to have_content('Nechám si ho poslať poštou') + expect(page).to have_content('Vyzdvihne ho za mňa iná osoba') + expect(page).to have_content('Vyzdvihnem ho osobne na úrade') + end + + scenario 'As a citizen I want to vote in a different voting district in both rounds' do + start + + choose 'Áno' + click_button 'Pokračovať' + + choose 'Áno' + click_button 'Pokračovať' + + check 'apps_president_vote_app_application_form[place_first_round]' + check 'apps_president_vote_app_application_form[place_second_round]' + click_button 'Pokračovať' + + expect(page).to have_content('Potrebujete požiadať o hlasovací preukaz pre obe kolá volieb') + expect(page).to have_content('Aby ste mohli v deň volieb voliť mimo vášho trvalého bydliska, musíte požiadať vašu obec o vydanie hlasovacieho preukazu – osobne alebo elektronicky. Hlasovací preukaz vás oprávňuje voliť z ktoréhokoľvek volebného okrsku v SR.') + expect(page).to have_content('Ako prevezmete hlasovací preukaz?') + expect(page).to have_content('Nechám si ho poslať poštou') + expect(page).to have_content('Vyzdvihne ho za mňa iná osoba') + expect(page).to have_content('Vyzdvihnem ho osobne na úrade') + end + + scenario 'As a citizen I want to vote in a different voting district and it is already past first round' do + travel_to Apps::PresidentVoteApp::ApplicationForm::FIRST_ROUND_DATE + 8.day + start + + choose 'Áno' + click_button 'Pokračovať' + + choose 'Áno' + click_button 'Pokračovať' + + expect(page).to have_content('Prvé kolo sa už konalo') + choose 'Mimo trvalého bydliska' + click_button 'Pokračovať' + + expect(page).to have_content('Potrebujete požiadať o hlasovací preukaz pre druhé kolo volieb') + expect(page).to have_content('Aby ste mohli v deň volieb voliť mimo vášho trvalého bydliska, musíte požiadať vašu obec o vydanie hlasovacieho preukazu – osobne alebo elektronicky. Hlasovací preukaz vás oprávňuje voliť z ktoréhokoľvek volebného okrsku v SR.') + expect(page).to have_content('Ako prevezmete hlasovací preukaz?') + expect(page).to have_content('Nechám si ho poslať poštou') + expect(page).to have_content('Vyzdvihne ho za mňa iná osoba') + expect(page).to have_content('Vyzdvihnem ho osobne na úrade') + end + + scenario 'As a citizen I want to request voting permit personally after the deadline' do + travel_to Apps::PresidentVoteApp::ApplicationForm::FIRST_ROUND_DATE - 2.day + start + choose 'Áno' + click_button 'Pokračovať' + + choose 'Áno' + click_button 'Pokračovať' + + check 'apps_president_vote_app_application_form[place_first_round]' + click_button 'Pokračovať' + + expect(page).to have_field('Vyzdvihne ho za mňa iná osoba', disabled: true) + expect(page).to have_field('Vyzdvihnem ho osobne na úrade', disabled: false) + end + + scenario 'As a citizen I want to request voting permit by authorized person after the deadline' do + travel_to Apps::PresidentVoteApp::ApplicationForm::FIRST_ROUND_DATE + 1.day + start + choose 'Áno' + click_button 'Pokračovať' + + choose 'Áno' + click_button 'Pokračovať' + + choose 'Mimo trvalého bydliska' + click_button 'Pokračovať' + + expect(page).to have_field('Vyzdvihne ho za mňa iná osoba', disabled: true) + end + + scenario 'As a citizen I want to request voting permit by post after the deadline' do + travel_to Apps::PresidentVoteApp::ApplicationForm::FIRST_ROUND_DATE + 1.day + start + choose 'Áno' + click_button 'Pokračovať' + + choose 'Áno' + click_button 'Pokračovať' + + choose 'Mimo trvalého bydliska' + click_button 'Pokračovať' + + expect(page).to have_field('Nechám si ho poslať poštou', disabled: true) + end + + scenario 'As a citizen I want to request voting permit personally' do + start + choose 'Áno' + click_button 'Pokračovať' + + choose 'Áno' + click_button 'Pokračovať' + + check 'apps_president_vote_app_application_form[place_first_round]' + click_button 'Pokračovať' + + choose 'Vyzdvihnem ho osobne' + click_button 'Pokračovať' + + expect(page).to have_content('Prevzatie hlasovacieho preukazu osobne') + end + + scenario 'As a citizen I want to request voting permit via authorized person' do + start + choose 'Áno' + click_button 'Pokračovať' + + choose 'Áno' + click_button 'Pokračovať' + + check 'apps_president_vote_app_application_form[place_first_round]' + check 'apps_president_vote_app_application_form[place_second_round]' + click_button 'Pokračovať' + + choose 'Vyzdvihne ho za mňa iná osoba' + click_button 'Pokračovať' + + fill_in 'Meno, priezvisko, titul', with: 'Ferko Mrkva', class: 'person' + fill_in 'Rodné číslo', with: '600101/1973', class: 'person' + fill_in 'Ulica', with: 'Pupavova 31' + fill_in 'PSČ', with: '456' + fill_in 'Obec', with: 'Bratislava - Karlova ves' + fill_in 'Meno, priezvisko, titul', with: 'Jarko Mrkva', class: 'authorized-person' + fill_in 'Číslo občianskeho preukazu', with: '567', class: 'authorized-person' + click_button 'Pokračovať' + + expect(page).to have_content('Meno: Ferko Mrkva') + expect(page).to have_content('Rodné číslo: 600101/1973') + expect(page).to have_content('Trvalý pobyt: Pupavova 31, 456 Bratislava - Karlova ves') + expect(page).to have_content("Preukaz vyzdvihne splnomocnená osoba:\r \r Meno: Jarko Mrkva\r Číslo občianskeho preukazu: 567") + + check 'Poslal/a som žiadosť zo svojho emailu na úrad' + end + + scenario 'As a citizen I want to vote at home address' do + start + choose 'Áno' + click_button 'Pokračovať' + + choose 'Áno' + click_button 'Pokračovať' + + click_button 'Pokračovať' + + expect(page).to have_content('Nepotrebujete nič vybavovať') + end + + scenario "As a non-SK citizen I can't vote in president votes" do + start + choose 'Nie' + click_button 'Pokračovať' + + expect(page).to have_content('môžu voliť len občania Slovenskej republiky.') + end + + scenario 'As a citizen I want to see subscription options when vote is not active' do + travel_to Apps::PresidentVoteApp::ApplicationForm::FIRST_ROUND_DATE + 15.day + visit apps_president_vote_app_application_forms_path + + expect(page).to have_content('Prezidentské voľby sa už konali') + expect(page).to have_content('Chcem dostávať upozornenia k voľbám') + end +end diff --git a/spec/features/health_spec.rb b/spec/features/health_spec.rb index eca08d9c..f3852c3e 100644 --- a/spec/features/health_spec.rb +++ b/spec/features/health_spec.rb @@ -1,9 +1,50 @@ require 'rails_helper' RSpec.feature "Healthcheck", type: :feature do - scenario 'As a healthcheck bot I want to check if everything is ok' do - visit health_path + context 'when healthcheck passes' do + scenario 'With healthcheck I want to check if everything is ok' do + visit health_path - expect(page.status_code).to be(200) + expect(page.status_code).to be(200) + + returned_data = JSON.parse(page.body) + + expect(returned_data["status"]).to eq("ok") + end + end + + context 'when healthcheck fails' do + scenario 'unexpected error in health check' do + allow_any_instance_of(HealthController).to receive(:all_database_healthy?).and_raise(StandardError, 'Unexpected error') + + visit health_path + + expect(page.status_code).to be(500) + returned_data = JSON.parse(page.body) + + expect(returned_data["status"]).to eq("fail") + end + + scenario 'primary database fails' do + allow(ApplicationRecord.connection).to receive(:execute).and_raise(StandardError, 'Something went wrong in primary db') + + visit health_path + + expect(page.status_code).to be(500) + returned_data = JSON.parse(page.body) + + expect(returned_data["status"]).to eq("fail") + end + + scenario 'datahub database fails' do + allow(DatahubRecord.connection).to receive(:execute).and_raise(StandardError, 'Something went wrong in datahub db') + + visit health_path + + expect(page.status_code).to be(500) + returned_data = JSON.parse(page.body) + + expect(returned_data["status"]).to eq("fail") + end end end