fixed date filter issues

This commit is contained in:
Luca Haid
2026-02-02 10:47:38 +01:00
parent 4f75985e3c
commit 6548daec82
2 changed files with 11 additions and 5 deletions

View File

@@ -45,12 +45,15 @@ class WorkorderDashboardController extends TTCrud
$userAddressId = intval($this->user->address_id);
$sql = "SELECT * FROM thetool.WorkorderCompany
WHERE visibleForAddressId IS NULL
OR FIND_IN_SET('$userAddressId', visibleForAddressId) > 0
OR JSON_CONTAINS(visibleForAddressId, '$userAddressId')
ORDER BY name ASC";
$result = $db->query($sql);
$companies = [];
while ($row = $result->fetch_object('WorkorderCompanyModel')) {
$companies[] = $row;
while ($row = $result->fetch_assoc()) {
$company = new WorkorderCompanyModel();
$company->id = (int)$row['id'];
$company->name = $row['name'];
$companies[] = $company;
}
}

View File

@@ -100,7 +100,7 @@ Vue.component('wd-trends-chart', {
responsive: true, maintainAspectRatio: false,
plugins: { legend: { position: 'top', labels: { usePointStyle: true } } },
scales: {
x: { type: 'time', time: { unit: 'day', displayFormats: { day: 'DD.MM' } }, grid: { display: false } },
x: { type: 'time', time: { unit: 'day', displayFormats: { day: 'DD.MM.YYYY' }, tooltipFormat: 'DD.MM.YYYY' }, grid: { display: false } },
y: { beginAtZero: true, grid: { color: 'rgba(0,0,0,0.05)' } }
}
}
@@ -134,7 +134,7 @@ Vue.component('workorder-dashboard', {
<div class="tt-scope workorder-dashboard">
<div class="filter-bar">
<div class="filter-bar__inner">
<tt-select sm label="Mandant" :value="selectedTenant" :options="[{value: '', text: 'Bitte wählen...'}, ...filterOptions.tenants]" @input="onTenantChange" />
<tt-select v-if="filterOptions.tenants.length > 1" sm label="Mandant" :value="selectedTenant" :options="[{value: '', text: 'Bitte wählen...'}, ...filterOptions.tenants]" @input="onTenantChange" />
<tt-date-picker sm label="Zeitraum" :value="dateRange" :date-range="true" :time-picker="false" @input="onDateRangeChange" />
<tt-select sm label="Firma" :value="selectedCompany" :options="[{value: '', text: 'Alle'}, ...filterOptions.companies]" @input="selectedCompany = $event; onFilterChange()" />
<tt-select sm label="Status" :value="selectedStatuses" :options="filterOptions.statuses" @input="selectedStatuses = $event; onFilterChange()" multiple />
@@ -233,6 +233,9 @@ Vue.component('workorder-dashboard', {
this.filterOptions.tenants = response.data.tenants;
this.filterOptions.companies = response.data.companies;
this.filterOptions.statuses = response.data.statuses;
if (this.filterOptions.tenants.length === 1) {
await this.onTenantChange(this.filterOptions.tenants[0].value);
}
} catch (error) { console.error('Error fetching filter options:', error); }
},
async onTenantChange(tenantId) {