mirror of
https://github.com/we-promise/sure.git
synced 2026-04-12 08:37:22 +00:00
fix(accounts): add duplicate action to activity view (#1418)
This commit is contained in:
committed by
GitHub
parent
a9a7a89f71
commit
d6d7df12fd
@@ -138,8 +138,13 @@ export default class extends Controller {
|
||||
count > 0;
|
||||
|
||||
if (this.hasDuplicateLinkTarget) {
|
||||
this.duplicateLinkTarget.classList.toggle("hidden", count !== 1);
|
||||
if (count === 1) {
|
||||
const selectedRow = this._selectedRow();
|
||||
const canDuplicate =
|
||||
count === 1 && selectedRow?.dataset.entryType === "Transaction";
|
||||
|
||||
this.duplicateLinkTarget.classList.toggle("hidden", !canDuplicate);
|
||||
|
||||
if (canDuplicate) {
|
||||
const url = new URL(
|
||||
this.duplicateLinkTarget.href,
|
||||
window.location.origin,
|
||||
@@ -158,6 +163,14 @@ export default class extends Controller {
|
||||
return this.pluralLabelValue;
|
||||
}
|
||||
|
||||
_selectedRow() {
|
||||
if (this.selectedIdsValue.length !== 1) return null;
|
||||
|
||||
return this.rowTargets.find(
|
||||
(row) => row.dataset.id === this.selectedIdsValue[0],
|
||||
);
|
||||
}
|
||||
|
||||
_updateGroups() {
|
||||
this.groupTargets.forEach((group) => {
|
||||
const rows = this.rowTargets.filter(
|
||||
|
||||
Reference in New Issue
Block a user