mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 15:04:04 +00:00
Make aggregators removable
This commit is contained in:
@@ -45,6 +45,9 @@ export default {
|
||||
addAggregator() {
|
||||
this.modelValue.push({});
|
||||
},
|
||||
removeAggregator(index) {
|
||||
this.$emit('update:modelValue', this.modelValue.toSpliced(index, 1));
|
||||
},
|
||||
preventOnCheckboxClick(evt) {
|
||||
if (evt.explicitOriginalTarget.classList.contains('form-check-label')) {
|
||||
evt.preventDefault();
|
||||
@@ -94,7 +97,7 @@ export default {
|
||||
</button>
|
||||
</h3>
|
||||
<div :id="'aggregator_' + myId + '_' + i" class="accordion-collapse collapse">
|
||||
<report-aggregator v-model="agg" class="accordion-body" :index="i" />
|
||||
<report-aggregator v-model="agg" class="accordion-body" :index="i" @remove="removeAggregator" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,18 @@ export default {
|
||||
},
|
||||
emits: [
|
||||
"update:modelValue",
|
||||
"remove",
|
||||
],
|
||||
methods: {
|
||||
remove() {
|
||||
this.$fhcAlert.confirmDelete()
|
||||
.then(result => {
|
||||
if (result)
|
||||
this.$emit('remove', this.index);
|
||||
})
|
||||
.catch(this.$fhcAlert.handleSystemError);
|
||||
},
|
||||
},
|
||||
template: /*html*/ `
|
||||
<div class="widgets-report-config-aggregators-aggregator">
|
||||
<form-input
|
||||
@@ -46,14 +57,20 @@ export default {
|
||||
:placeholder="$p.t('dashboard/widget_report_kpi_aggregator_fields_placeholder')"
|
||||
class="mb-3"
|
||||
/>
|
||||
<form-input
|
||||
v-model="defaultAggregatorIndex"
|
||||
type="radio"
|
||||
name="aggregatordefault"
|
||||
container-class="form-switch"
|
||||
:label="$p.t('ui/default')"
|
||||
:value="index"
|
||||
/>
|
||||
<div class="d-flex justify-content-between align-items-baseline">
|
||||
<form-input
|
||||
v-model="defaultAggregatorIndex"
|
||||
type="radio"
|
||||
name="aggregatordefault"
|
||||
container-class="form-switch"
|
||||
:label="$p.t('ui/default')"
|
||||
:value="index"
|
||||
/>
|
||||
<button type="button" class="btn btn-danger" @click="remove">
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
{{ $p.t('ui/loeschen') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user