1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-27 17:19:39 +02:00

Merge branch 'main' into jose/line-charts

This commit is contained in:
Jose Farias 2024-04-20 12:55:13 -06:00 committed by GitHub
commit c65b08efe5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 66 additions and 20 deletions

View file

@ -0,0 +1,20 @@
import { Controller } from "@hotwired/stimulus";
import { CurrenciesService } from "services/currencies_service";
// Connects to data-controller="money-field"
// when currency select change, update the input value with the correct placeholder and step
export default class extends Controller {
static targets = ["amount", "currency"];
handleCurrencyChange() {
const selectedCurrency = event.target.value;
this.updateAmount(selectedCurrency);
}
updateAmount(currency) {
(new CurrenciesService).get(currency).then((data) => {
this.amountTarget.placeholder = data.placeholder;
this.amountTarget.step = data.step;
});
}
}