Skip to content

Commit

Permalink
Merge pull request #606 from City-of-Helsinki/main
Browse files Browse the repository at this point in the history
Update main 4.6.0 to 5.x
  • Loading branch information
Arkkimaagi authored Mar 28, 2023
2 parents b5c33ad + 8a32d87 commit 9f02131
Show file tree
Hide file tree
Showing 9 changed files with 382 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/js/accordion.min.js

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

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.

3 changes: 2 additions & 1 deletion src/js/accordion/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export default class State {
this.pageAccordionStates = {};
} else {
this.siteAccordionStates = siteAccordions;
this.pageAccordionStates = this.siteAccordionStates[this.page] === undefined ? {} : this.siteAccordionStates[this.page];
this.siteAccordionStates[this.page] = this.siteAccordionStates[this.page] === undefined ? {} : this.siteAccordionStates[this.page];
this.pageAccordionStates = this.siteAccordionStates[this.page];
}
}

Expand Down
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 };
Loading

0 comments on commit 9f02131

Please sign in to comment.