Merge branch 'fix-new-dashboard' into 'master'
Fix new dashboard See merge request fronk/thetool!921
This commit is contained in:
@@ -168,6 +168,79 @@ class DashboardNewController extends mfBaseController {
|
||||
PreorderModel::countActive($params);
|
||||
};
|
||||
|
||||
if ($this->me->address_id === '4807') {
|
||||
|
||||
$inhouse_kabel_verlegt_efh = $countFunction([">status_code" => "243", "<status_code" => "899"]);
|
||||
$timeline_inhouse_kabel_verlegt_efh = $this->getTimeline('weekly-inhouse-kabel-verlegt-efh', $campaign_ids, $gemeinde_ids);
|
||||
$inhouse_kabel_verlegt_efh_base_value_before_history = $inhouse_kabel_verlegt_efh - $timeline_inhouse_kabel_verlegt_efh[0][count($timeline_inhouse_kabel_verlegt_efh[0]) - 1]['value'];
|
||||
|
||||
foreach ($timeline_inhouse_kabel_verlegt_efh[0] as $key => $value) {
|
||||
$timeline_inhouse_kabel_verlegt_efh[0][$key]['value'] += $inhouse_kabel_verlegt_efh_base_value_before_history;
|
||||
}
|
||||
|
||||
$status_500_energie_steiermark = $countFunction(["partner_id" => [209,5033, 3151, 7685, 7754, 7764], "status_code" => "500", "<status_code" => 899]);
|
||||
$timeline_status_500_energie_steiermark = $this->getTimeline('weekly-order-finished-energy-steiermark', $campaign_ids, $gemeinde_ids);
|
||||
$status_500_energie_steiermark_base_value_before_history = $status_500_energie_steiermark - $timeline_status_500_energie_steiermark[0][count($timeline_status_500_energie_steiermark[0]) - 1]['value'];
|
||||
// var_dump($this->getTimeline('weekly-order-finished-energy-steiermark', $campaign_ids, $gemeinde_ids));exit;
|
||||
|
||||
foreach ($timeline_status_500_energie_steiermark[0] as $key => $value) {
|
||||
$timeline_status_500_energie_steiermark[0][$key]['value'] += $status_500_energie_steiermark_base_value_before_history;
|
||||
}
|
||||
|
||||
$status_500_magenta = $countFunction(["partner_id" => 4803, "status_code" => "500", "<status_code" => 899]);
|
||||
$timeline_status_500_magenta = $this->getTimeline('weekly-order-finished-magenta', $campaign_ids, $gemeinde_ids);
|
||||
$status_500_magenta_base_value_before_history = $status_500_magenta - $timeline_status_500_magenta[0][count($timeline_status_500_magenta[0]) - 1]['value'];
|
||||
|
||||
foreach ($timeline_status_500_magenta[0] as $key => $value) {
|
||||
$timeline_status_500_magenta[0][$key]['value'] += $status_500_magenta_base_value_before_history;
|
||||
}
|
||||
|
||||
$status_500_salzburg_ag = $countFunction(["partner_id" => 5668, "status_code" => "500", "<status_code" => 899]);
|
||||
$timeline_status_500_salzburg_ag = $this->getTimeline('weekly-order-finished-salzburg-ag', $campaign_ids, $gemeinde_ids);
|
||||
$status_500_salzburg_ag_base_value_before_history = $status_500_salzburg_ag - $timeline_status_500_salzburg_ag[0][count($timeline_status_500_salzburg_ag[0]) - 1]['value'];
|
||||
|
||||
foreach ($timeline_status_500_salzburg_ag[0] as $key => $value) {
|
||||
$timeline_status_500_salzburg_ag[0][$key]['value'] += $status_500_salzburg_ag_base_value_before_history;
|
||||
}
|
||||
|
||||
self::returnJson([
|
||||
'type' => 'rml',
|
||||
'order_max_home_addrdb' => $order_max_homes,
|
||||
'order_actual_order' => $countFunction([]),
|
||||
'order_energie_steiermark' => $countFunction(["partner_id" => [209,5033, 3151, 7685, 7754, 7764]]),
|
||||
'order_magenta' => $countFunction(["partner_id" => 4803]),
|
||||
'order_salzburg_ag' => $countFunction(["partner_id" => 5668]),
|
||||
'baufortschritt_140' => $countFunction([">status_code" => "139", "<status_code" => "899"]),
|
||||
|
||||
// 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' => $inhouse_kabel_verlegt_efh,
|
||||
'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_inhouse_kabel_verlegt_efh' => $timeline_inhouse_kabel_verlegt_efh,
|
||||
'timeline_status_500_energie_steiermark' => $timeline_status_500_energie_steiermark,
|
||||
'timeline_status_500_magenta' => $timeline_status_500_magenta,
|
||||
'timeline_status_500_salzburg_ag' => $timeline_status_500_salzburg_ag,
|
||||
|
||||
// status 244 245 -
|
||||
'status_244_245_energie_steiermark' => $countFunction(["partner_id" => [209,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' => $status_500_energie_steiermark,
|
||||
'status_500_magenta' => $status_500_magenta,
|
||||
'status_500_salzburg_ag' => $status_500_salzburg_ag,
|
||||
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
$baufortschritt_140 = $countFunction([">status_code" => "139", "<status_code" => "899"]);
|
||||
$timeline_baufortschritt_140 = $this->getTimeline('weekly-leerrohr', $campaign_ids, $gemeinde_ids);
|
||||
$baufortschritt_140_base_value_before_history = $baufortschritt_140 - $timeline_baufortschritt_140[0][count($timeline_baufortschritt_140[0]) - 1]['value'];
|
||||
@@ -185,45 +258,6 @@ class DashboardNewController extends mfBaseController {
|
||||
$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" => [209,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" => [209,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" => [209,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,
|
||||
@@ -316,6 +350,28 @@ class DashboardNewController extends mfBaseController {
|
||||
$params['add-where'] = " AND ph.`create` <= UNIX_TIMESTAMP('" . $date . " 23:59:59')";
|
||||
$value = PreorderModel::countHistoryStatus($params, 300);
|
||||
break;
|
||||
case 'weekly-inhouse-kabel-verlegt-efh':
|
||||
$params['add-where'] = " AND ph.`create` <= UNIX_TIMESTAMP('" . $date . " 23:59:59')";
|
||||
$value = PreorderModel::countHistoryStatus($params, 244) + PreorderModel::countHistoryStatus($params, 245);
|
||||
break;
|
||||
case 'weekly-order-finished-energy-steiermark':
|
||||
$params['partner_id'] = [209,5033, 3151, 7685, 7754, 7764];
|
||||
$params["<status_code"] = 899;
|
||||
$params['add-where'] = " AND ph.`create` <= UNIX_TIMESTAMP('" . $date . " 23:59:59')";
|
||||
$value = PreorderModel::countHistoryStatus($params, 500);
|
||||
break;
|
||||
case 'weekly-order-finished-magenta':
|
||||
$params['partner_id'] = 4803;
|
||||
$params["<status_code"] = 899;
|
||||
$params['add-where'] = " AND ph.`create` <= UNIX_TIMESTAMP('" . $date . " 23:59:59')";
|
||||
$value = PreorderModel::countHistoryStatus($params, 500);
|
||||
break;
|
||||
case 'weekly-order-finished-salzburg-ag':
|
||||
$params['partner_id'] = 5668;
|
||||
$params["<status_code"] = 899;
|
||||
$params['add-where'] = " AND ph.`create` <= UNIX_TIMESTAMP('" . $date . " 23:59:59')";
|
||||
$value = PreorderModel::countHistoryStatus($params, 500);
|
||||
break;
|
||||
}
|
||||
|
||||
$newData = [
|
||||
|
||||
@@ -905,7 +905,7 @@ class PreorderModel {
|
||||
LEFT JOIN `".FRONKDB_DBNAME."`.Preorderstatus tt_preorderstatus ON tt_preorder.status_id = tt_preorderstatus.id
|
||||
LEFT JOIN `".ADDRESSDB_DBNAME."`.view_hausnummer as adb_hausnummer ON (tt_preorder.adb_hausnummer_id = adb_hausnummer.hausnummer_id)
|
||||
INNER JOIN `".FRONKDB_DBNAME."`.PreorderHistory ph ON tt_preorder.id = ph.preorder_id
|
||||
WHERE $where AND ph.`key` like 'status_id' AND tt_preorderstatus.code = ".$status_code;
|
||||
WHERE $where AND ph.`key` like 'status_id' AND tt_preorderstatus.code = ".$status_code." AND ph.new_value = tt_preorder.status_id";
|
||||
|
||||
$queryStart = microtime(true);
|
||||
$res = $db->query($sql);
|
||||
|
||||
@@ -446,23 +446,39 @@ Vue.component('dashboard-rml', {
|
||||
{
|
||||
label: 'Bestellungen',
|
||||
data: dashboardData.timeline[0],
|
||||
color: 'rgb(75, 192, 192)',
|
||||
color: 'rgb(23, 162, 184)',
|
||||
fill: true,
|
||||
yAxisID: 'y',
|
||||
order: 5
|
||||
},
|
||||
{
|
||||
label: 'Summe von 244+245',
|
||||
data: dashboardData.timeline_inhouse_kabel_verlegt_efh[0],
|
||||
color: 'rgb(0, 123, 255)',
|
||||
fill: false,
|
||||
yAxisID: 'y',
|
||||
order: 4
|
||||
},
|
||||
{
|
||||
label: 'Status 500 Energie Steiermark',
|
||||
data: dashboardData.timeline_status_500_energie_steiermark[0],
|
||||
color: 'rgb(40, 167, 69)',
|
||||
fill: false,
|
||||
yAxisID: 'y',
|
||||
order: 3
|
||||
},
|
||||
{
|
||||
label: 'Leerrohr',
|
||||
data: dashboardData.timeline_leerrohr[0],
|
||||
color: 'rgb(255, 99, 132)',
|
||||
label: 'Status 500 Magenta',
|
||||
data: dashboardData.timeline_status_500_magenta[0],
|
||||
color: 'rgb(226, 0, 116)',
|
||||
fill: false,
|
||||
yAxisID: 'y',
|
||||
order: 2
|
||||
},
|
||||
{
|
||||
label: 'ONT installiert',
|
||||
data: dashboardData.timeline_ont_installed[0],
|
||||
color: 'rgb(54, 162, 235)',
|
||||
label: 'Status 500 Salzburg AG',
|
||||
data: dashboardData.timeline_status_500_salzburg_ag[0],
|
||||
color: 'rgb(0, 102, 179)',
|
||||
fill: false,
|
||||
yAxisID: 'y',
|
||||
order: 1
|
||||
|
||||
Reference in New Issue
Block a user