Merge branch 'WorkorderDashboard/improve-and-fix' into 'master'
fixed date filter issues See merge request fronk/thetool!2074
This commit is contained in:
@@ -45,12 +45,15 @@ class WorkorderDashboardController extends TTCrud
|
|||||||
$userAddressId = intval($this->user->address_id);
|
$userAddressId = intval($this->user->address_id);
|
||||||
$sql = "SELECT * FROM thetool.WorkorderCompany
|
$sql = "SELECT * FROM thetool.WorkorderCompany
|
||||||
WHERE visibleForAddressId IS NULL
|
WHERE visibleForAddressId IS NULL
|
||||||
OR FIND_IN_SET('$userAddressId', visibleForAddressId) > 0
|
OR JSON_CONTAINS(visibleForAddressId, '$userAddressId')
|
||||||
ORDER BY name ASC";
|
ORDER BY name ASC";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
$companies = [];
|
$companies = [];
|
||||||
while ($row = $result->fetch_object('WorkorderCompanyModel')) {
|
while ($row = $result->fetch_assoc()) {
|
||||||
$companies[] = $row;
|
$company = new WorkorderCompanyModel();
|
||||||
|
$company->id = (int)$row['id'];
|
||||||
|
$company->name = $row['name'];
|
||||||
|
$companies[] = $company;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ Vue.component('wd-trends-chart', {
|
|||||||
responsive: true, maintainAspectRatio: false,
|
responsive: true, maintainAspectRatio: false,
|
||||||
plugins: { legend: { position: 'top', labels: { usePointStyle: true } } },
|
plugins: { legend: { position: 'top', labels: { usePointStyle: true } } },
|
||||||
scales: {
|
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)' } }
|
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="tt-scope workorder-dashboard">
|
||||||
<div class="filter-bar">
|
<div class="filter-bar">
|
||||||
<div class="filter-bar__inner">
|
<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-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="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 />
|
<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.tenants = response.data.tenants;
|
||||||
this.filterOptions.companies = response.data.companies;
|
this.filterOptions.companies = response.data.companies;
|
||||||
this.filterOptions.statuses = response.data.statuses;
|
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); }
|
} catch (error) { console.error('Error fetching filter options:', error); }
|
||||||
},
|
},
|
||||||
async onTenantChange(tenantId) {
|
async onTenantChange(tenantId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user