1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-20 13:49:39 +02:00

Add transaction sidebar (#534)

* Create sidebar element and working with turbo

* Add overview fields

* Add columns to transations and tidy modal

* permit new transaction params

* Add autosubmit form controller

* remove unused show code
This commit is contained in:
Cristiano Crolla 2024-03-10 21:38:31 +00:00 committed by GitHub
parent 9c9459211f
commit 7f2633f9da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 134 additions and 15 deletions

View file

@ -0,0 +1,33 @@
import { Controller } from '@hotwired/stimulus';
export default class extends Controller {
get cssInputSelector() {
return 'input:not(.no-auto-submit), textarea:not(.no-auto-submit)';
}
get inputElements() {
return this.element.querySelectorAll(this.cssInputSelector);
}
get selectElements() {
return this.element.querySelectorAll('select:not(.no-auto-submit)');
}
connect() {
this.inputElements.forEach(el => el.addEventListener('change', this.handler.bind(this)));
this.selectElements.forEach(el => el.addEventListener('change', this.handler.bind(this)));
}
disconnect() {
this.inputElements.forEach(el => el.removeEventListener('change', this.handler.bind(this)));
this.selectElements.forEach(el => el.removeEventListener('change', this.handler.bind(this)));
}
handler(e) {
console.log(e);
this.element.requestSubmit();
}
}