Merge branch 'fix-new-dashboard' into 'master'

updated rml dashboard

See merge request fronk/thetool!914
This commit is contained in:
Luca Haid
2025-01-16 06:11:53 +00:00
2 changed files with 229 additions and 24 deletions

View File

@@ -168,27 +168,64 @@ class DashboardNewController extends mfBaseController {
PreorderModel::countActive($params);
};
$baufortschritt_140 = $countFunction([">status_code" => "139", "<status_code" => "899"]);
$timeline_baufortschritt_140 = $this->getTimeline('weekly-leerrohr', $campaign_ids, $gemeinde_ids);
$ont_installiert_300 = $countFunction([">status_code" => "299", "<status_code" => "899"]);
$timeline_ont_installiert_300 = $this->getTimeline('weekly-ont-installed', $campaign_ids, $gemeinde_ids);
$baufortschritt_140_base_value_before_history = $baufortschritt_140 - $timeline_baufortschritt_140[0][count($timeline_baufortschritt_140[0]) - 1]['value'];
foreach ($timeline_baufortschritt_140[0] as $key => $value) {
$timeline_baufortschritt_140[0][$key]['value'] += $baufortschritt_140_base_value_before_history;
}
$ont_installiert_300 = $countFunction([">status_code" => "299", "<status_code" => "899"]);
$timeline_ont_installiert_300 = $this->getTimeline('weekly-ont-installed', $campaign_ids, $gemeinde_ids);
$ont_installiert_300_base_value_before_history = $ont_installiert_300 - $timeline_ont_installiert_300[0][count($timeline_ont_installiert_300[0]) - 1]['value'];
foreach ($timeline_ont_installiert_300[0] as $key => $value) {
$timeline_ont_installiert_300[0][$key]['value'] += $ont_installiert_300_base_value_before_history;
}
if ($this->me->address_id === '4807') {
self::returnJson([
'type' => 'rml',
'order_max_home_addrdb' => $order_max_homes,
'order_actual_order' => $countFunction([]),
'order_energie_steiermark' => $countFunction(["partner_id" => [20,5033, 3151, 7685, 7754, 7764]]),
'order_magenta' => $countFunction(["partner_id" => 4803]),
'order_salzburg_ag' => $countFunction(["partner_id" => 5668]),
'baufortschritt_140' => $baufortschritt_140,
// MAYBE OVERWORK
'order_efh' => $countFunction(["connection_type" => $efh_connection_types]),
'installationspaket_erhalten' => $countFunction(["connection_type" => $efh_connection_types], 145),
'lehrrohr_im_haus' => $countFunction(["connection_type" => $efh_connection_types], 200),
//END MAYBE OVERWORK
'inhouse_kabel_verlegt_efh' => $countFunction([">status_code" => "243", "<status_code" => "899"]),
'inhouse_kabel_verlegt_efh_magenta' => $countFunction([">status_code" => "243", "<status_code" => "899", "partner_id" => 4803]),
'inhouse_kabel_verlegt_efh_salzburg' => $countFunction([">status_code" => "243", "<status_code" => "899", "partner_id" => 5668]),
'order_mph' => $countFunction(["connection_type" => $mph_connection_types]),
'inhouse_kabel_verlegt_mph' => $countFunction(["connection_type" => $mph_connection_types], 242),
'timeline' => $this->getTimeline('weekly-orders', $campaign_ids, $gemeinde_ids),
'timeline_leerrohr' => $timeline_baufortschritt_140,
'timeline_ont_installed' => $timeline_ont_installiert_300,
// status 244 245 -
'status_244_245_energie_steiermark' => $countFunction(["partner_id" => [20,5033, 3151, 7685, 7754, 7764], ">status_code" => "243", "<status_code" => "899"]),
'status_244_245_magenta' => $countFunction(["partner_id" => 4803, ">status_code" => "243", "<status_code" => "899"]),
'status_244_245_salzburg_ag' => $countFunction(["partner_id" => 5668, ">status_code" => "243", "<status_code" => "899"]),
'status_500_energy_steiermark' => $countFunction(["partner_id" => [20,5033, 3151, 7685, 7754, 7764], "status_code" => "500"]),
'status_500_magenta' => $countFunction(["partner_id" => 4803, "status_code" => "500"]),
'status_500_salzburg_ag' => $countFunction(["partner_id" => 5668, "status_code" => "500"]),
]);
}
self::returnJson([
'type' => 'default',
'order_max_home_addrdb' => $order_max_homes,
'order_actual_order' => $countFunction([]),
'order_efh' => $countFunction(["connection_type" => $efh_connection_types]),
@@ -210,9 +247,19 @@ class DashboardNewController extends mfBaseController {
'timeline' => $this->getTimeline('weekly-orders', $campaign_ids, $gemeinde_ids),
'timeline_leerrohr' => $timeline_baufortschritt_140,
'timeline_ont_installed' => $timeline_ont_installiert_300
]);
}
//Installationsfortschritt Provider
//
// jasmin wegkommt
// psc raaba 0316 67 33 00 zollweg michael (
// zollweg michael
private function getTimeline($type, $campaign_ids, $gemeinde_ids) { //TODO: fix gemeinde
$timeline = [];
$baseParams = ["preordercampaign_id" => $campaign_ids, "gemeinde_id" => $gemeinde_ids];

View File

@@ -58,7 +58,7 @@ Vue.component('tt-dashboard-display-card', {
props: ['header', 'icon', 'text', 'subHeaders', 'color'],
computed: {
cardHeight() {
return `${96 + 25 * this.subHeaders.length}px`;
return `${96 + 25 * this.subHeaders?.length ?? 0}px`;
}
},
template: `
@@ -188,25 +188,10 @@ Vue.component('tt-timeline-chart', {
});
Vue.component('dashboard-new', {
Vue.component('dashboard-default', {
props: ['dashboardData'],
template: `
<tt-card>
<template v-slot:header>
<h3>Akquise Statistiken</h3>
</template>
<tt-loader v-if="isLoading" style="margin: -5rem -1.5rem -1.5rem;"/>
<div class="dashboard-new">
<dashboard-location-selector
:selectedNetworkOwner="selectedNetworkOwner"
:selectedCampaign="selectedCampaign"
:selectedGemeinde="selectedGemeinde"
@update:selectedNetworkOwner="selectedNetworkOwner = $event"
@update:selectedCampaign="selectedCampaign = $event"
@update:selectedGemeinde="selectedGemeinde = $event"
/>
<hr>
<div>
<h4 class="mt-4">Bestellungen</h4>
<div class="dashboard-cards position-relative">
<tt-dashboard-display-card
@@ -356,12 +341,185 @@ Vue.component('dashboard-new', {
/>
</div>
</div>`
})
Vue.component('dashboard-rml', {
props: ['dashboardData'],
template: `
<div>
<h4 class="mt-4">Bestellungen</h4>
<div class="dashboard-cards position-relative">
<tt-dashboard-display-card
header="Bestellungen gesamt"
icon="fas fa-check"
:text="dashboardData.order_actual_order + ' / ' + dashboardData.order_max_home_addrdb + ' (' + Math.round((dashboardData.order_actual_order / dashboardData.order_max_home_addrdb) * 100) + '%)'"
color="#28a745"
/>
<tt-dashboard-display-card
header="Bestellungen Energie Steiermark"
icon="fas fa-bolt"
:text="dashboardData.order_energie_steiermark + ' / ' + dashboardData.order_actual_order + ' (' + Math.round((dashboardData.order_energie_steiermark / dashboardData.order_actual_order) * 100) + '%)'"
color="#28a745"
/>
<tt-dashboard-display-card
header="Bestellungen Magenta"
icon="fas fa-mobile-alt"
:text="dashboardData.order_magenta + ' / ' + dashboardData.order_actual_order + ' (' + Math.round((dashboardData.order_magenta / dashboardData.order_actual_order) * 100) + '%)'"
color="#E20074"
/>
<tt-dashboard-display-card
header="Bestellungen Salzburg AG"
icon="fas fa-plug"
:text="dashboardData.order_salzburg_ag + ' / ' + dashboardData.order_actual_order + ' (' + Math.round((dashboardData.order_salzburg_ag / dashboardData.order_actual_order) * 100) + '%)'"
color="#0066B3"
/>
</div>
<hr>
<h4 class="mt-4">Baufortschritt</h4>
<div class="dashboard-cards position-relative">
<tt-dashboard-display-card
header="Leerrohr an der Grundstücksgrenze abgelegt"
icon="fas fa-road"
:text="dashboardData.baufortschritt_140 + ' / ' + dashboardData.order_actual_order + ' (' + Math.round((dashboardData.baufortschritt_140 / dashboardData.order_actual_order) * 100) + '%)'"
color="#28a745"
/>
<tt-dashboard-display-card
header="Installationspaket erhalten"
icon="fas fa-box-open"
:text="dashboardData.installationspaket_erhalten + ' / ' + dashboardData.order_efh + ' (' + Math.round((dashboardData.installationspaket_erhalten / dashboardData.order_efh) * 100) + '%)'"
color="#17a2b8"
/>
<tt-dashboard-display-card
header="Leerrohr im Haus"
icon="fas fa-house-user"
:text="dashboardData.lehrrohr_im_haus + ' / ' + dashboardData.order_efh + ' (' + Math.round((dashboardData.lehrrohr_im_haus / dashboardData.order_efh) * 100) + '%)'"
color="#f5b902"
/>
<tt-dashboard-display-card
header="BEP installiert EFH"
icon="fas fa-plug"
:text="dashboardData.inhouse_kabel_verlegt_efh + ' / ' + dashboardData.order_efh + ' (' + Math.round((dashboardData.inhouse_kabel_verlegt_efh / dashboardData.order_efh) * 100) + '%)'"
:sub-headers="[
'Magenta: ' + dashboardData.inhouse_kabel_verlegt_efh_magenta + ' (' + Math.round((dashboardData.inhouse_kabel_verlegt_efh_magenta / dashboardData.order_magenta) * 100) + '%)',
'Salzburg AG: ' + dashboardData.inhouse_kabel_verlegt_efh_salzburg + ' (' + Math.round((dashboardData.inhouse_kabel_verlegt_efh_salzburg / dashboardData.order_salzburg_ag) * 100) + '%)'
]"
color="#007bff"
/>
<tt-dashboard-display-card
header="Inhousekabel verlegt MPH"
icon="fas fa-building-user"
:text="dashboardData.inhouse_kabel_verlegt_mph + ' / ' + dashboardData.order_mph + ' (' + Math.round((dashboardData.inhouse_kabel_verlegt_mph / dashboardData.order_mph) * 100) + '%)'"
color="#0bb36c"
/>
</div>
<hr>
<h4 class="mt-4">Installationsfortschritt Provider</h4>
<div class="dashboard-cards position-relative">
<tt-dashboard-display-card
header="Installationsfortschritt Energie Steiermark"
icon="fas fa-bolt"
:text="dashboardData.status_244_245_energie_steiermark + ' / ' + dashboardData.order_energie_steiermark + ' (' + Math.round((dashboardData.status_244_245_energie_steiermark / dashboardData.order_energie_steiermark) * 100) + '%)'"
:sub-headers="[
'Status 500: ' + dashboardData.status_500_energy_steiermark + ' (' + Math.round((dashboardData.status_500_energy_steiermark / dashboardData.status_244_245_energie_steiermark) * 100) + '%)'
]"
color="#28a745"
/>
<tt-dashboard-display-card
header="Installationsfortschritt Magenta"
icon="fas fa-mobile-alt"
:text="dashboardData.status_244_245_magenta + ' / ' + dashboardData.order_magenta + ' (' + Math.round((dashboardData.status_244_245_magenta / dashboardData.order_magenta) * 100) + '%)'"
:sub-headers="[
'Status 500: ' + dashboardData.status_500_magenta + ' (' + Math.round((dashboardData.status_500_magenta / dashboardData.status_244_245_magenta) * 100) + '%)'
]"
color="#E20074"
/>
<tt-dashboard-display-card
header="Installationsfortschritt Salzburg AG"
icon="fas fa-plug"
:text="dashboardData.status_244_245_salzburg_ag + ' / ' + dashboardData.order_salzburg_ag + ' (' + Math.round((dashboardData.status_244_245_salzburg_ag / dashboardData.order_salzburg_ag) * 100) + '%)'"
:sub-headers="[
'Status 500: ' + dashboardData.status_500_salzburg_ag + ' (' + Math.round((dashboardData.status_500_salzburg_ag / dashboardData.status_244_245_salzburg_ag) * 100) + '%)'
]"
color="#0066B3"
/>
</div>
<hr>
<h4 class="mt-4">Bestellverlauf</h4>
<div class="dashboard-chart">
<tt-timeline-chart
v-if="dashboardData.timeline.length > 0"
:datasets="[
{
label: 'Bestellungen',
data: dashboardData.timeline[0],
color: 'rgb(75, 192, 192)',
fill: true,
yAxisID: 'y',
order: 3
},
{
label: 'Leerrohr',
data: dashboardData.timeline_leerrohr[0],
color: 'rgb(255, 99, 132)',
fill: false,
yAxisID: 'y',
order: 2
},
{
label: 'ONT installiert',
data: dashboardData.timeline_ont_installed[0],
color: 'rgb(54, 162, 235)',
fill: false,
yAxisID: 'y',
order: 1
}
]"
label="KW"
:showGrid="false"
/>
</div>
</div>
`
})
Vue.component('dashboard-new', {
template: `
<tt-card>
<template v-slot:header>
<h3>Akquise Statistiken</h3>
</template>
<tt-loader v-if="isLoading" style="margin: -5rem -1.5rem -1.5rem;"/>
<div class="dashboard-new">
<dashboard-location-selector
:selectedNetworkOwner="selectedNetworkOwner"
:selectedCampaign="selectedCampaign"
:selectedGemeinde="selectedGemeinde"
@update:selectedNetworkOwner="selectedNetworkOwner = $event"
@update:selectedCampaign="selectedCampaign = $event"
@update:selectedGemeinde="selectedGemeinde = $event"
/>
<hr>
<dashboard-default v-if="dashboardData.type === 'default'" :dashboardData="dashboardData"/>
<dashboard-rml v-else-if="dashboardData.type === 'rml'" :dashboardData="dashboardData"/>
</div>
</tt-card>
`,
data() {
return {
dashboardData: {
type: 'unloaded',
order_max_home_addrdb: 0,
order_actual_order: "0",
order_efh: "0",