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

UHF-7484: Add initial version of service housing service voucher calculator #603

Merged
merged 3 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dist/js/service_housing_service_voucher.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 70 additions & 3 deletions src/js/calculator/example-calc.html
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,40 @@
}
}
`;
drupalSettings.service_housing_service_voucher = `{}`;
drupalSettings.service_housing_service_voucher = `
{
"voucher_from_net_income": {
"0": 3300,
"900.01": 3200,
"1000.01": 3100,
"1100.01": 3000,
"1200.01": 2900,
"1300.01": 2800,
"1400.01": 2700,
"1500.01": 2600,
"1600.01": 2500,
"1700.01": 2400,
"1800.01": 2300,
"1900.01": 2200,
"2000.01": 2100,
"2100.01": 2000,
"2200.01": 1900,
"2300.01": 1800,
"2400.01": 1700,
"2500.01": 1600,
"2600.01": 1500,
"2700.01": 1400,
"2800.01": 1300,
"2900.01": 1200,
"3000.01": 1100,
"3100.01": 1000,
"3200.01": 900,
"3300.01": 800,
"3400.01": 700,
"3500.01": 600
}
}
`;
drupalSettings.family_with_kids_home_service_client_payment = `{}`;
drupalSettings.daycare_payment = `
{
Expand Down Expand Up @@ -508,10 +541,10 @@ <h2 class="component__title">House cleaning service voucher</h2>
</div>
</div>

<!-- -->
<!-- - ->
<script>
// window.onload = () => {
// document.querySelector("#preset_1").click();
// document.querySelector("#preset_3").click();
// window.setTimeout(() => {
// window.scrollTo(0, document.body.scrollHeight);
// }, 600);
Expand Down Expand Up @@ -583,6 +616,40 @@ <h2 class="component__title">Laske arvio asiakasmaksusta</h2>
</div>
</div>
</div>
<!-- -->
<!-- -->
<script>
// window.onload = () => {
// document.querySelector("#preset_4").click();
// window.setTimeout(() => {
// window.scrollTo(0, document.body.scrollHeight);
// }, 600);
// }
</script>
<button id="preset_4" onclick="setValues('helfi_calc_1655488697',{
'#net_income_per_month_helfi_calc_1655488697': 1291.66,
'#service_provider_price_helfi_calc_1655488697': 3200,
'input.hds-button--primary': true
})">Debug</button>
<div class="component component--helfi-calculator">
<div class="component__container">
<h2 class="component__title">Täytä tiedot palvelusetelin arvon arvioimiseksi</h2>
<div class="component__content helfi-calculator">
<noscript>
<div class="component__needs-js">
<p>Sorry, as we do not send your data anywhere from this calculator to keep your data safe, it needs Javascript to work. Please enable Javascript in your browser to use this calculator.</p>
</div>
</noscript>
<div id="helfi_calc_1655488697"></div>
<script src="../../../dist/js/service_housing_service_voucher.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', (event) => {
const clean = window.helfi_calculator.service_housing_service_voucher('helfi_calc_1655488697', drupalSettings.service_housing_service_voucher);
});
</script>
</div>
</div>
</div>
<!-- -->
</div>
</body>
Expand Down
34 changes: 34 additions & 0 deletions src/js/calculator/service_housing_service_voucher/_form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
function getFormData(id, t) {
return {
form_id: id,
has_required_fields: true,
items: [
{
input_float: {
id: 'net_income_per_month',
label: t('net_income_per_month'),
unit: t('unit_euro'),
min: 0,
size: 8,
required: true,
strip: '[€eE ]',
helper_text: t('net_income_per_month_explanation'),
},
},
{
input_float: {
id: 'service_provider_price',
label: t('service_provider_price'),
unit: t('unit_euro'),
min: 0,
size: 8,
required: true,
strip: '[€eE ]',
helper_text: t('service_provider_price_explanation'),
},
},
]
};
}

export default { getFormData };
86 changes: 86 additions & 0 deletions src/js/calculator/service_housing_service_voucher/_translations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/* eslint-disable no-template-curly-in-string */

const translations = {
net_income_per_month: {
fi: 'Nettotulot kuukaudessa',
sv: null,
en: null,
},
net_income_per_month_explanation: {
fi: 'Nettotulot tarkoittavat tuloja verojen vähentämisen jälkeen. Tuloihin lasketaan eläkkeet, elatusavut, elinkorot, elatustuki sekä muut jatkuvat henkilökohtaiset tulot ja pääomasta tai omaisuudesta(kuten korko-, osinko- ja vuokratulot). Eläkkeen saajan hoitotukea, asumistukea, rintamalisää tai sotavammalain mukaista elinkorkoa ei huomioida.',
sv: null,
en: null,
},
service_provider_price: {
fi: 'Palveluntuottajan kuukausihinta',
sv: null,
en: null,
},
service_provider_price_explanation: {
fi: 'Valitsemasi palveluntuottajan perimä palveluasumisen kuukausihinta.',
sv: null,
en: null,
},
receipt_estimate_of_payment: {
fi: 'Arvio palveluasumisen palvelusetelistä',
sv: null,
en: null,
},
receipt_estimated_payment_prefix: {
fi: 'Omavastuuosuus eli sinulle maksettavaksi jäävä asiakasmaksu on',
sv: null,
en: null,
},
receipt_estimated_payment_suffix: {
fi: 'euroa kuukaudessa.',
sv: null,
en: null,
},
receipt_estimated_payment_explanation: {
fi: 'Tämä arvio on suuntaa antava. Tarkka arvo lasketaan kotihoidon tekemän päätöksen mukaan.',
sv: null,
en: null,
},
receipt_estimate_is_based_on: {
fi: 'Palveluasumisen hinta palvelusetelillä ostettuna muodostuu seuraavasti:',
sv: null,
en: null,
},
receipt_subtotal_full_price: {
fi: 'Palveluasumisen kokonaiskustannus',
sv: null,
en: null,
},
receipt_subtotal_city_price: {
fi: 'Kaupunki maksaa palvelusetelillä yksityiselle tuottajalle ',
sv: null,
en: null,
},
receipt_subtotal_self_price: {
fi: 'Sinulle maksettavaksi jäävä osuus eli omavastuu',
sv: null,
en: null,
},
receipt_subtotal_euros_per_month: {
fi: '${value} €/kk',
sv: null,
en: null,
},
receipt_subtotal_euros_per_month_screenreader: {
fi: '${value} euroa kuukaudessa',
sv: null,
en: null,
},
receipt_additional_details: {
fi: 'Lisähuomiot:',
sv: null,
en: null,
},
receipt_aria_live: {
fi: 'Omavastuuosuus eli sinulle maksettavaksi jäävä asiakasmaksu on ${payment} euroa kuukaudessa, lue lisätietoja lomakkeen alta.',
sv: null,
en: null,
},
};

export default translations;
Loading