Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vote app enable preukaz #594

Merged
merged 12 commits into from
Aug 23, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,20 @@
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */

var SPREADSHEET_JSON_URL = 'https://spreadsheets.google.com/feeds/list/1UWA_P-OrH-IvmZnqO89FF2OzQ3gdhQCi3HLRHKx4RZI/oc4boel/public/values?alt=json';
var SPREADSHEET_JSON_URL = 'https://sheets.googleapis.com/v4/spreadsheets/1zGC07Zp77EF1lSFCITCWwXFOuNERMzkCrSLVeWzss-k/values/master!C2:G?alt=json&key=AIzaSyDEUeT4Ov9rkc6egolxX1ejoqqNwY7eAm8';

function convertSourceDataToMunicipality(data) {
var CONST_MUNICIPALITY = 'gsx$obec';
var CONST_PRIMARY_EMAIL = 'gsx$editaciesemfinalakinyakoij';
var CONST_EMAIL = 'gsx$emailprevolbupostou';
var CONST_COUNTY = 'gsx$okres';
var CONST_STATUS = 'gsx$status';
var CONST_MUNICIPALITY = 0;
var CONST_COUNTY = 1;
var CONST_STATUS = 3;
var CONST_EMAIL = 4;

var result = {
municipalityName: data[CONST_MUNICIPALITY]['$t'],
countyName: data[CONST_COUNTY]['$t'],
email: data[CONST_PRIMARY_EMAIL]['$t'] == '' ? data[CONST_EMAIL]['$t'] : data[CONST_PRIMARY_EMAIL]['$t'],
municipalityName: data[CONST_MUNICIPALITY],
countyName: data[CONST_COUNTY],
email: data[CONST_EMAIL],
payload: {
status: data[CONST_STATUS]['$t']
status: data[CONST_STATUS]
}
};

Expand All @@ -97,9 +96,9 @@
var municipalityIndices = {};
var result = [];

if (response.feed && response.feed.entry)
if (response.values)
{
$.each(response.feed.entry, function (i, data) {
$.each(response.values, function (i, data) {
var item = convertSourceDataToMunicipality(data);
var countyName = item.countyName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-xl">Zaslanie žiadosti na úrad</h1>
<h1 class="govuk-heading-xl">Pošlite žiadosť na úrad</h1>

<div>
<% if @application_form.municipality_email.present? %>
<p class="govuk-body-l">Otvorte
<%= mail_to @application_form.municipality_email, 'pripravenú žiadosť v emailovom klientovi'.html_safe,
target: '_blank',
body: @application_form.from_slovakia_authorized_person_email_body,
subject: 'Žiadosť o hlasovací preukaz do parlamentý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 %>
</p>
<% else %>
<p class="govuk-body-l">Skopírujte text žiadosti a pošlite ho na emailovú adresu obce.</p>
<% end %>
</div>
<div class="govuk-form-group">
<textarea onclick="this.focus();this.select();" rows="8" class="govuk-textarea"><%= @application_form.from_slovakia_authorized_person_email_body %></textarea>
</div>

<%= render 'municipality_email_warning' %>

<h3 class="govuk-heading-l">Pokyny</h3>
<ol class="govuk-list govuk-list--number govuk-!-font-size-24">
<li class="govuk-!-margin-bottom-4">
<% if @application_form.municipality_email.present? %>
Otvorte
<%= mail_to @application_form.municipality_email, 'pripravenú žiadosť v emailovom klientovi'.html_safe,
target: '_blank',
body: @application_form.from_slovakia_authorized_person_email_body,
subject: 'Žiadosť o hlasovací preukaz do parlamentých volieb.'
%>
alebo ju manuálne
<a href="#" onclick="document.getElementById('conditional-manual').style.display = 'block'; return false;">skopírujte</a>.
<% end %>
<div id="conditional-manual"<% if @application_form.municipality_email.present? %> style="display: none;"<% end %>>
<p class="govuk-body govuk-!-margin-top-5">Skopírujte text žiadosti.</p>
<div class="govuk-form-group">
<textarea onclick="this.focus();this.select();" rows="8" class="govuk-textarea"><%= @application_form.from_slovakia_authorized_person_email_body %></textarea>
</div>
</div>
</li>
<li class="govuk-!-margin-bottom-4">
Odošlite na emailovú adresu obce<% if @application_form.municipality_email.present? %> <strong><%= @application_form.municipality_email %></strong><% end %>.
</li>
<li>
A potom <%= link_to 'pokračujte ďalej', end_apps_parliament_vote_app_application_forms_url %>.
</li>
</ol>
<div class="govuk-checkboxes__item">
<input class="govuk-checkboxes__input" id="waste" name="waste" type="checkbox" value="carcasses" onchange="document.getElementById('nextButton').disabled = !this.checked;">
<label class="govuk-label govuk-checkboxes__label" for="waste">Poslal/a som žiadosť na úrad</label>
</div>

<%= 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 %>
<% end %>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-xl">Potrebujete požiadať o hlasovací preukaz</h1>
<p class="govuk-body-lead">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&nbsp;ktoréhokoľvek volebného okrsku v SR.</p>
<% if true %>
<% if false %>
<p class="govuk-body-lead"><strong>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ť.</strong> Posledný termín na zaslanie žiadosti je 8.&nbsp;septembra.</p>
<%= render 'apps/parliament_vote_app/application_forms/subscribe' %>
<% else %>
Expand Down
56 changes: 28 additions & 28 deletions app/views/apps/parliament_vote_app/application_forms/send.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-xl">Zaslanie žiadosti na úrad</h1>
<h1 class="govuk-heading-xl">Pošlite žiadosť na úrad</h1>

<div>
<% if @application_form.municipality_email.present? %>
<p class="govuk-body-l">Otvorte
<%= mail_to @application_form.municipality_email, 'pripravenú žiadosť v emailovom klientovi'.html_safe,
target: '_blank',
body: @application_form.from_slovakia_email_body,
subject: 'Žiadosť o hlasovací preukaz do parlamentý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 %>
</p>
<% else %>
<p class="govuk-body-l">Skopírujte text žiadosti a pošlite ho na emailovú adresu obce.</p>
<% end %>
</div>
<div class="govuk-form-group">
<textarea onclick="this.focus();this.select();" rows="8" class="govuk-textarea"><%= @application_form.from_slovakia_email_body %></textarea>
</div>

<%= render 'municipality_email_warning' %>

<h2 class="govuk-heading-l">Pokyny</h2>
<ol class="govuk-list govuk-list--number govuk-!-font-size-24">
<li class="govuk-!-margin-bottom-4">
<% if @application_form.municipality_email.present? %>
Ak máte na zariadení emailového klienta,
<%= mail_to @application_form.municipality_email, 'kliknutím tu priamo otvorte pripravenú žiadosť. '.html_safe,
target: '_blank',
body: @application_form.from_slovakia_email_body,
subject: 'Žiadosť o hlasovací preukaz do parlamentných volieb.'
%>
Alternatívne kliknutím
<a href="#" onclick="document.getElementById('conditional-manual').style.display = 'block'; return false;">tu žiadosť zobrazte</a> a manuálne ju skopírujte do tela emailu.
<% end %>
<div id="conditional-manual"<% if @application_form.municipality_email.present? %> style="display: none;"<% end %>>
<p class="govuk-body govuk-!-margin-top-5">Skopírujte text žiadosti.</p>
<div class="govuk-form-group">
<textarea onclick="this.focus();this.select();" rows="8" class="govuk-textarea"><%= @application_form.from_slovakia_email_body %></textarea>
</div>
</div>
</li>
<li class="govuk-!-margin-bottom-4">
Odošlite na emailovú adresu obce<% if @application_form.municipality_email.present? %> <strong><%= @application_form.municipality_email %></strong><% end %>.
</li>
<li>
A potom <%= link_to 'pokračujte ďalej', end_apps_parliament_vote_app_application_forms_url %>.
</li>
</ol>
<div class="govuk-checkboxes__item">
<input class="govuk-checkboxes__input" id="waste" name="waste" type="checkbox" value="carcasses" onchange="document.getElementById('nextButton').disabled = !this.checked;">
<label class="govuk-label govuk-checkboxes__label" for="waste">Poslal/a som žiadosť na úrad</label>
</div>

<%= 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 %>
<% end %>
</div>
</div>
146 changes: 73 additions & 73 deletions spec/features/apps/parliament_vote_app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,54 +25,56 @@ def start

expect(page).to have_content('Potrebujete požiadať o hlasovací preukaz')
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('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.')
expect(page).to have_content('Ako prevezmete hlasovací preukaz?')
expect(page).to have_content('Poštou')
expect(page).to have_content('Vyzdvihne ho za mňa iná osoba')
expect(page).to have_content('Osobne na úrade')
end

# TODO: /app/views/apps/parliament_vote_app/application_forms/delivery.html.erb:13 "else"
# 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
# choose 'Áno'
# click_button 'Pokračovať'
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
choose 'Áno'
click_button 'Pokračovať'

# choose 'Áno'
# click_button 'Pokračovať'
choose 'Áno'
click_button 'Pokračovať'

# choose 'Na Slovensku, mimo trvalého bydliska'
# click_button 'Pokračovať'
choose 'Na Slovensku, mimo trvalého bydliska'
click_button 'Pokračovať'

# expect(page).to have_field('Osobne na úrade', disabled: true)
# end
expect(page).to have_field('Osobne na úrade', disabled: true)
end

# 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
# choose 'Áno'
# click_button 'Pokračovať'
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
choose 'Áno'
click_button 'Pokračovať'

# choose 'Áno'
# click_button 'Pokračovať'
choose 'Áno'
click_button 'Pokračovať'

# choose 'Na Slovensku, mimo trvalého bydliska'
# click_button 'Pokračovať'
choose 'Na Slovensku, mimo trvalého bydliska'
click_button 'Pokračovať'

# expect(page).to have_field('Vyzdvihne ho za mňa iná osoba', disabled: true)
# end
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::ParliamentVoteApp::ApplicationForm::DELIVERY_BY_POST_DEADLINE_DATE + 1.day
# start
# choose 'Áno'
# click_button 'Pokračovať'
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
choose 'Áno'
click_button 'Pokračovať'

# choose 'Áno'
# click_button 'Pokračovať'
choose 'Áno'
click_button 'Pokračovať'

# choose 'Na Slovensku, mimo trvalého bydliska'
# click_button 'Pokračovať'
choose 'Na Slovensku, mimo trvalého bydliska'
click_button 'Pokračovať'

# expect(page).to have_field('Poštou', disabled: true)
# end
expect(page).to have_field('Poštou', disabled: true)
end

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
Expand Down Expand Up @@ -101,55 +103,53 @@ def start
expect(page).to have_content('Termín na zaslanie žiadosti o voľbu poštou uplynul 9. augusta')
end

# # TODO: /app/views/apps/parliament_vote_app/application_forms/delivery.html.erb:13 "else"
# scenario 'As a citizen I want to request voting permit personally' do
# start
# choose 'Áno'
# click_button 'Pokračovať'
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ť'
choose 'Áno'
click_button 'Pokračovať'

# choose 'Na Slovensku, mimo trvalého bydliska'
# click_button 'Pokračovať'
choose 'Na Slovensku, mimo trvalého bydliska'
click_button 'Pokračovať'

# choose 'Osobne'
# click_button 'Pokračovať'
choose 'Osobne'
click_button 'Pokračovať'

# expect(page).to have_content('Prevzatie hlasovacieho preukazu osobne')
# end
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ť'
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ť'
choose 'Áno'
click_button 'Pokračovať'

# choose 'Na Slovensku, mimo trvalého bydliska'
# click_button 'Pokračovať'
choose 'Na Slovensku, mimo trvalého bydliska'
click_button 'Pokračovať'

# choose 'Vyzdvihne ho za mňa iná osoba'
# 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: '123', 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ť'
fill_in 'Meno, priezvisko, titul', with: 'Ferko Mrkva', class: 'person'
fill_in 'Rodné číslo', with: '123', 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: 123')
# expect(page).to have_content('Trvalý pobyt: Pupavova 31, 456 Bratislava - Karlova ves')
# expect(page).to have_content('Preukaz vyzdvihne splnomocnená osoba: Meno: Jarko Mrkva Číslo občianskeho preukazu: 567')
expect(page).to have_content('Meno: Ferko Mrkva')
expect(page).to have_content('Rodné číslo: 123')
expect(page).to have_content('Trvalý pobyt: Pupavova 31, 456 Bratislava - Karlova ves')
expect(page).to have_content('Preukaz vyzdvihne splnomocnená osoba: Meno: Jarko Mrkva Číslo občianskeho preukazu: 567')

# click_link 'pokračujte ďalej'
# expect(page).to have_content('Gratulujeme')
# end
check 'Poslal/a som žiadosť na úrad'
end

scenario 'As a citizen I want to vote at home address' do
start
Expand Down