From 3bc9208c65c7ff3aae250a51c10b13a95ac2a215 Mon Sep 17 00:00:00 2001 From: Leopold Strobl Date: Tue, 27 Feb 2024 16:24:51 +0100 Subject: [PATCH] --- Aufgabenmonitor.php | 113 +++++++++++++++++++++++++++++++++++ CrewbrainApi.php | 12 ++-- Packmonitor.php | 8 +-- config.php | 9 ++- sources/getAufgabenTable.php | 99 +++++++++++++++++++++++------- sources/getCheckInTable.php | 98 ++++++++++++++++++++---------- sources/getCheckOutTable.php | 105 +++++++++++++++++++++----------- sources/getSidenav.php | 4 ++ 8 files changed, 351 insertions(+), 97 deletions(-) create mode 100644 Aufgabenmonitor.php diff --git a/Aufgabenmonitor.php b/Aufgabenmonitor.php new file mode 100644 index 0000000..e4013e6 --- /dev/null +++ b/Aufgabenmonitor.php @@ -0,0 +1,113 @@ + + + + + + + + + + + Aufgabenmonitor + + + + + + + + + + + + + + +
+
+
+

Aufgaben

+ + + + + + + + + + + + + +
#BearbeiterAufgabeZieldatumPriorität
+ + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/CrewbrainApi.php b/CrewbrainApi.php index 753301f..dfa7640 100644 --- a/CrewbrainApi.php +++ b/CrewbrainApi.php @@ -8,13 +8,15 @@ class CrewBrain{ public function requestCrewBrainApi(string $requestString){ - $client = new GuzzleHttp\Client(); + $client = new GuzzleHttp\Client([ + 'auth' => [CrewBrain_Username, CrewBrain_password] + ]); $requestUrl = CrewBrain_Connectionprotocol."://". CrewBrain_Server."/".$requestString; $response = $client->request('GET', $requestUrl,[ - 'headers' =>[ - - 'X-API-KEY' => CrewBrain_Token - ] +// 'headers' =>[ +// +// 'X-API-KEY' => CrewBrain_Token +// ] ]); // $json = json_decode($response->getBody()); diff --git a/Packmonitor.php b/Packmonitor.php index 8bd397b..ec9a298 100644 --- a/Packmonitor.php +++ b/Packmonitor.php @@ -63,8 +63,8 @@ $Epi = new Epirent(); # Kunde Event - Dispo-Start - Dispo-Ende + Dispo-Start
VB-Start + Dispo-Ende
VB-Ende @@ -84,8 +84,8 @@ $Epi = new Epirent(); # Kunde Event - Dispo-Start - Dispo-Ende + Dispo-Start
RP-Start + Dispo-Ende
RP-Ende diff --git a/config.php b/config.php index 54fa092..80b318e 100644 --- a/config.php +++ b/config.php @@ -5,9 +5,16 @@ define('Epirent_Connectionprotocol', 'http'); define('Epirent_Port', '8080'); define('Epirent_Token', 'BCEF15F4DC1F2F448BA07E5364EDDAE3'); define('Epirent_Mandant', '2'); -define('CrewBrain_Token', '1bd5a96db84d62e52544204651735136'); +define('CrewBrain_Username', 'l.strobl'); +define('CrewBrain_password', '14032015'); define('CrewBrain_Server', 'vt-media.crewbrain.com'); define('CrewBrain_Connectionprotocol', 'https'); +define('CrewBrain_TaskListID', 6); +define('Enable_QR_Code_CrewBrainAufgaben', true); define('Enable_QR_Code_CheckOut', true); define('Enable_QR_Code_CheckIn', true); +define('Vorbereitungs_Zeitvariable', 'Vorbereitung'); +define('Rueckpacken_Zeitvariable', 'Rückpacken'); +define('CheckOut_UseDispoStartForRowMarking', true); //else: Use Same Variable as "Vorbereitung Zeitvariable" +define('CheckIn_UseDispoEndForRowMarking', true); //else: Use Same Variable as "Rueckpacken Zeitvariable" ?> diff --git a/sources/getAufgabenTable.php b/sources/getAufgabenTable.php index 2d0f830..a8db572 100644 --- a/sources/getAufgabenTable.php +++ b/sources/getAufgabenTable.php @@ -3,35 +3,94 @@ require('../config.php'); require('../CrewbrainApi.php'); + +use chillerlan\QRCode\{ + QRCode, + QROptions +}; + require('../vendor/autoload.php'); + +$options = new QROptions([ + 'imageBase64' => false, + 'qrCodeHeight' => 75, + 'qrCodeWidth' => 75, + 'version' => -1, + 'quietzoneSize' => 1 + ]); + + $CrewBrain = new CrewBrain(); -$result = $Epi->requestEpiApi('/v1/packingnote/open?isco=False&cl=' . Epirent_Mandant); -$result = $CrewBrain->requestCrewBrainApi('api/tasklist/5'); -$data_output = json_decode($result)->payload; + +$result = $CrewBrain->requestCrewBrainApi('api/tasklist/' . CrewBrain_TaskListID . '/tasks'); -foreach ($data_output as $packingjob) { +$data_output = json_decode($result); - $date = new DateTime($packingjob->date_end); - $date->setTime(0, 0, 0); - $today = new DateTime(); - $today->setTime(0, 0, 0); - if ($date == $today) { - echo ""; - } else if ($date < $today) { - echo ""; - } else { - echo ""; +foreach ($data_output as $aufgabe) { + + + + if ($aufgabe->Geloescht == null) { + + $AufgabeDetail = json_decode($CrewBrain->requestCrewBrainApi('api/task/'.$aufgabe->ID)); + + if ($aufgabe->Zieldatum == null) { + echo ""; + } else { + + $date = new DateTime($aufgabe->Zieldatum); + $date->setTime(0, 0, 0); + $today = new DateTime(); + $today->setTime(0, 0, 0); + if ($date == $today) { + + echo ""; + } else if ($date < $today) { + echo ""; + } else { + echo ""; + } + } + if (Enable_QR_Code_CrewBrainAufgaben) { + echo "" . '
' . (new QRCode($options))->render(CrewBrain_Connectionprotocol . '://' . CrewBrain_Server . '/aufgaben/' . CrewBrain_TaskListID . '/aufgabe/' . $aufgabe->ID) . "
"; + } else { + echo "" . $aufgabe->ID . ""; + } + echo ""; + + + foreach($AufgabeDetail->Responsibles as $bearbeiter){ + echo $bearbeiter->Name; + } + echo ""; + echo "" . $aufgabe->Titel . ""; + if ($aufgabe->Zieldatum != null) { + echo "" . date_format(new \DateTime($aufgabe->Zieldatum), 'd.m.Y') . ""; + } else { + echo "nA"; + } + + + switch ($aufgabe->Prioritaet) { + case -1: + echo ' Niedrig'; + break; + case 0: + echo ' Normal'; + break; + case 1: + ' Höher'; + break; + case 2: + ' Hoch'; + break; + } + echo ""; } - echo "" . $packingjob->primary_key . ""; - echo "" . $packingjob->contact->name . ""; - echo "" . $packingjob->event . ""; - echo "" . date_format(new \DateTime($packingjob->date_start), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_start) . ""; - echo "" . date_format(new \DateTime($packingjob->date_end), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_end) . ""; - echo ""; } function getTimeFromSeconds(string $timestring) { diff --git a/sources/getCheckInTable.php b/sources/getCheckInTable.php index febdc56..822608e 100644 --- a/sources/getCheckInTable.php +++ b/sources/getCheckInTable.php @@ -2,18 +2,21 @@ require('../config.php'); require('../EpiApi.php'); -use chillerlan\QRCode\{QRCode, QROptions}; + +use chillerlan\QRCode\{ + QRCode, + QROptions +}; + require('../vendor/autoload.php'); $options = new QROptions([ - 'imageBase64' => false, - - 'qrCodeHeight' => 75, - 'qrCodeWidth' => 75, - 'version' =>-1, - 'quietzoneSize' => 1 - -]); + 'imageBase64' => false, + 'qrCodeHeight' => 75, + 'qrCodeWidth' => 75, + 'version' => -1, + 'quietzoneSize' => 1 + ]); $Epi = new Epirent(); @@ -25,32 +28,63 @@ $data_output = json_decode($result)->payload; foreach ($data_output as $packingjob) { -if($packingjob->is_archived != true){ - $date = new DateTime($packingjob->date_end); - $date->setTime(0, 0, 0); - $today = new DateTime(); - $today->setTime(0, 0, 0); - if ($date == $today) { - echo ""; - } else if ($date < $today) { - echo ""; - } else { - echo ""; - } - if(Enable_QR_Code_CheckIn){ - echo "" .'
'.(new QRCode($options))->render($packingjob->packingnote_no)."
"; - } - else { - echo "" . $packingjob->packingnote_no .""; + + if ($packingjob->is_archived != true) { + + //get OrderDetails + $result = $Epi->requestEpiApi('/v1/order/' . $packingjob->order_pk . '?cl=' . Epirent_Mandant); + + $orderdetail_output = json_decode($result)->payload[0]; + + $NachbereitungsTimeDetail; + + foreach ($orderdetail_output->order_schedule as $scheduledetail) { + + if ($scheduledetail->name == Rueckpacken_Zeitvariable) { + $NachbereitungsTimeDetail = $scheduledetail; + } + } + + + //End Of get Order Details + + if (CheckIn_UseDispoEndForRowMarking || ($NachbereitungsTimeDetail->date_start==null)) { + $date = new DateTime($packingjob->date_end); + } else { + $date = new DateTime($NachbereitungsTimeDetail->date_start); + } + $date->setTime(0, 0, 0); + $today = new DateTime(); + $today->setTime(0, 0, 0); + if ($date == $today) { + + echo ""; + } else if ($date < $today) { + echo ""; + } else { + echo ""; + } + if (Enable_QR_Code_CheckIn) { + echo "" . '
' . (new QRCode($options))->render($packingjob->packingnote_no) . "
"; + } else { + echo "" . $packingjob->packingnote_no . ""; + } + echo "" . $packingjob->contact->name . ""; + echo "" . $packingjob->event . ""; + if ($NachbereitungsTimeDetail->date_start != null) { + echo "" . date_format(new \DateTime($packingjob->date_start), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_start) . "
" . date_format(new \DateTime($NachbereitungsTimeDetail->date_start), 'd.m.Y') . " " . getTimeFromSeconds($NachbereitungsTimeDetail->time_start) . ""; + } else { + echo "" . date_format(new \DateTime($packingjob->date_start), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_start) . ""; + } + if ($NachbereitungsTimeDetail->date_end != null) { + echo "" . date_format(new \DateTime($packingjob->date_end), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_end) . "
" . date_format(new \DateTime($NachbereitungsTimeDetail->date_end), 'd.m.Y') . " " . getTimeFromSeconds($NachbereitungsTimeDetail->time_end) . ""; + } else { + echo "" . date_format(new \DateTime($packingjob->date_end), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_end) . ""; + } + echo ""; } - echo "" . $packingjob->contact->name . ""; - echo "" . $packingjob->event . ""; - echo "" . date_format(new \DateTime($packingjob->date_start), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_start) . ""; - echo "" . date_format(new \DateTime($packingjob->date_end), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_end) . ""; - echo ""; -} } function getTimeFromSeconds(string $timestring) { diff --git a/sources/getCheckOutTable.php b/sources/getCheckOutTable.php index a49cdaf..6f6397e 100644 --- a/sources/getCheckOutTable.php +++ b/sources/getCheckOutTable.php @@ -3,18 +3,20 @@ require('../config.php'); require('../EpiApi.php'); -use chillerlan\QRCode\{QRCode, QROptions}; +use chillerlan\QRCode\{ + QRCode, + QROptions +}; + require('../vendor/autoload.php'); $options = new QROptions([ - 'imageBase64' => false, - - 'qrCodeHeight' => 75, - 'qrCodeWidth' => 75, - 'version' =>-1, - 'quietzoneSize' => 1 - -]); + 'imageBase64' => false, + 'qrCodeHeight' => 75, + 'qrCodeWidth' => 75, + 'version' => -1, + 'quietzoneSize' => 1 + ]); $Epi = new Epirent(); @@ -28,37 +30,69 @@ $data_output = json_decode($result)->payload; foreach ($data_output as $packingjob) { - if($packingjob->is_archived != true){ - - $date = new DateTime($packingjob->date_start); - $date->setTime(0, 0, 0); - $today = new DateTime(); - $today->setTime(0, 0, 0); - if ($date == $today) { - echo ""; - } else if ($date < $today) { - echo ""; - } else { - echo ""; - } - if(Enable_QR_Code_CheckOut){ - echo "" .'
'.(new QRCode($options))->render($packingjob->packingnote_no)."
"; - } - else { - echo "" . $packingjob->packingnote_no .""; + + if ($packingjob->is_archived != true) { + + //get OrderDetails + $result = $Epi->requestEpiApi('/v1/order/' . $packingjob->order_pk . '?cl=' . Epirent_Mandant); + + $orderdetail_output = json_decode($result)->payload[0]; + + $VorbereitungsTimeDetail; + + foreach ($orderdetail_output->order_schedule as $scheduledetail) { + + if ($scheduledetail->name == Vorbereitungs_Zeitvariable) { + $VorbereitungsTimeDetail = $scheduledetail; + } + } + + + //End Of get Order Details + + if (CheckOut_UseDispoStartForRowMarking || ($VorbereitungsTimeDetail->date_start == null)) { + $date = new DateTime($packingjob->date_start); + + } else { + $date = new DateTime($VorbereitungsTimeDetail->date_start); + + } + + $date->setTime(0, 0, 0); + $today = new DateTime(); + $today->setTime(0, 0, 0); + if ($date == $today) { + + echo ""; + } else if ($date < $today) { + echo ""; + } else { + echo ""; + } + + if (Enable_QR_Code_CheckOut) { + echo "" . '
' . (new QRCode($options))->render($packingjob->packingnote_no) . "
"; + } else { + echo "" . $packingjob->packingnote_no . ""; + } + echo "" . $packingjob->contact->name . ""; + echo "" . $packingjob->event . ""; + if ($VorbereitungsTimeDetail->date_start != null) { + echo "" . date_format(new \DateTime($packingjob->date_start), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_start) . "
" . date_format(new \DateTime($VorbereitungsTimeDetail->date_start), 'd.m.Y') . " " . getTimeFromSeconds($VorbereitungsTimeDetail->time_start) . ""; + } else { + echo "" . date_format(new \DateTime($packingjob->date_start), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_start) . ""; + } + if ($VorbereitungsTimeDetail->date_end != null) { + echo "" . date_format(new \DateTime($packingjob->date_end), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_end) . "
" . date_format(new \DateTime($VorbereitungsTimeDetail->date_end), 'd.m.Y') . " " . getTimeFromSeconds($VorbereitungsTimeDetail->time_end) . ""; + } else { + echo "" . date_format(new \DateTime($packingjob->date_end), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_end) . ""; + } + echo ""; } - echo "" . $packingjob->contact->name . ""; - echo "" . $packingjob->event . ""; - echo "" . date_format(new \DateTime($packingjob->date_start), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_start) . ""; - echo "" . date_format(new \DateTime($packingjob->date_end), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_end) . ""; - echo ""; - } -} - function getTimeFromSeconds(string $timestring) { @@ -70,4 +104,5 @@ function getTimeFromSeconds(string $timestring) { return $timeFormat; } + ?> \ No newline at end of file diff --git a/sources/getSidenav.php b/sources/getSidenav.php index e37d825..aae8625 100644 --- a/sources/getSidenav.php +++ b/sources/getSidenav.php @@ -17,6 +17,10 @@ Packmonitor + + + Aufgabenmonitor +