Report multi-selection

This commit is contained in:
Jiang Yio 2023-05-25 06:18:49 -04:00
parent baa8103167
commit f6408e0188

View File

@ -12,9 +12,8 @@
</li> </li>
<li class="list-group-item d-flex justify-content-between align-items-center"> <li class="list-group-item d-flex justify-content-between align-items-center">
<div class="btn-group"> <div class="btn-group">
<button v-for="report in reports" class="btn" :class="{ 'btn-primary': report.enabled, 'btn-outline-primary': !report.enabled }" @click="toggle(report)">{{report.name}}</button> <button v-for="report in reports" class="btn" :class="{ 'btn-primary': report.enabled, 'btn-outline-primary': !report.enabled }" @click="enable(report)">{{report.name}}<input type="checkbox" class="form-check-input" :checked="report.enabled" @click.stop="report.enabled = !report.enabled" /></button>
</div> </div>
<button class="btn" :class="{ 'btn-success': unify, 'btn-outline-success': !unify }" @click="unify = !unify">Unify</button>
<DateRangePicker range="Range" direction="-1" v-model:date="date_end" v-model:date_end="date_begin" /> <DateRangePicker range="Range" direction="-1" v-model:date="date_end" v-model:date_end="date_begin" />
</li> </li>
</ul> </ul>
@ -56,6 +55,12 @@
top: 3.65rem; top: 3.65rem;
z-index: 2; z-index: 2;
} }
div.filter input.form-check-input {
position: absolute;
top: 0;
right: 0;
margin-top: 0;
}
div.selector { div.selector {
position: sticky; position: sticky;
top: 1.15rem; top: 1.15rem;
@ -423,7 +428,6 @@
date_next: null, date_next: null,
query: '', query: '',
x_query: '', x_query: '',
unify: false,
reports: create_reports(), reports: create_reports(),
loaders: {}, loaders: {},
resultsets: {}, resultsets: {},
@ -476,10 +480,8 @@
timestring(date) { timestring(date) {
return date.toLocaleTimeString('en-GB').substring(0, 5); return date.toLocaleTimeString('en-GB').substring(0, 5);
}, },
toggle(report) { enable(report) {
if(report.enabled) report.enabled = false; if(!report.enabled) {
else if(this.unify) report.enabled = true;
else {
var reports = this.reports; var reports = this.reports;
for(var i = reports.length - 1; i >= 0; --i) reports[i].enabled = false; for(var i = reports.length - 1; i >= 0; --i) reports[i].enabled = false;
report.enabled = true; report.enabled = true;