mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 13:19:39 +02:00
Bulk transaction deletion (#845)
* Clean up transaction show view, add delete button * Clean up tailwind global styles, add switch * Bulk deletion controller and tests * Normalize translations * Add bulk deletion button and form
This commit is contained in:
parent
115f792198
commit
d3f9be15f1
8 changed files with 225 additions and 95 deletions
|
@ -18,6 +18,12 @@ export default class extends Controller {
|
|||
document.removeEventListener("turbo:load", this.#updateView)
|
||||
}
|
||||
|
||||
submitBulkDeletionRequest(e) {
|
||||
const form = e.target.closest("form");
|
||||
this.#addHiddenFormInputsForSelectedIds(form, "bulk_delete[transaction_ids][]", this.selectedIdsValue)
|
||||
form.requestSubmit()
|
||||
}
|
||||
|
||||
togglePageSelection(e) {
|
||||
if (e.target.checked) {
|
||||
this.#selectAll()
|
||||
|
@ -54,6 +60,16 @@ export default class extends Controller {
|
|||
this.#updateView()
|
||||
}
|
||||
|
||||
#addHiddenFormInputsForSelectedIds(form, paramName, transactionIds) {
|
||||
transactionIds.forEach(id => {
|
||||
const input = document.createElement("input");
|
||||
input.type = 'hidden'
|
||||
input.name = paramName
|
||||
input.value = id
|
||||
form.appendChild(input)
|
||||
})
|
||||
}
|
||||
|
||||
#rowsForGroup(group) {
|
||||
return this.rowTargets.filter(row => group.contains(row))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue