Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Id 39 as a stakeholder i want to have a driving dashboard so the driver feedback can be showed after using the var #23

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
12e59c9
ID-39 Update README
jihye2084 Dec 14, 2023
57b6cfb
Merge branch 'main' into ID-39-As-a-stakeholder-I-want-to-have-a-driv…
jihye2084 Jan 8, 2024
b2da024
ID-39
jihye2084 Jan 8, 2024
d5338de
Compile and minify production files
invalid-email-address Jan 8, 2024
c1ef00c
ID-39
jihye2084 Jan 8, 2024
a911c9f
Merge branch 'ID-39-As-a-stakeholder-I-want-to-have-a-driving-dashboa…
jihye2084 Jan 8, 2024
5afa8a2
Compile and minify production files
invalid-email-address Jan 8, 2024
cf0db98
ID-39
jihye2084 Jan 15, 2024
8c82282
Merge branch 'ID-39-As-a-stakeholder-I-want-to-have-a-driving-dashboa…
jihye2084 Jan 15, 2024
8fc0c17
Compile and minify production files
invalid-email-address Jan 15, 2024
c847385
ID-39
jihye2084 Jan 15, 2024
3a56063
Compile and minify production files
invalid-email-address Jan 15, 2024
5751f69
Merge branch 'main' into ID-39-As-a-stakeholder-I-want-to-have-a-driv…
jihye2084 Jan 16, 2024
c603ca9
Merge branch 'ID-39-As-a-stakeholder-I-want-to-have-a-driving-dashboa…
jihye2084 Jan 16, 2024
0453d3b
Some bootstrap things
leonoosterhuis Jan 16, 2024
6d694a4
Compile and minify production files
invalid-email-address Jan 16, 2024
bc0ae3b
ID-39
jihye2084 Jan 16, 2024
61350cc
Compile and minify production files
invalid-email-address Jan 16, 2024
31ed1c0
ID-39
jihye2084 Jan 17, 2024
809eb68
Compile and minify production files
invalid-email-address Jan 17, 2024
5a16fea
Merge branch 'main' into ID-39-As-a-stakeholder-I-want-to-have-a-driv…
leonoosterhuis Jan 22, 2024
55a60e5
Fixed PostTripJob
leonoosterhuis Jan 22, 2024
808c70b
ID-39 Fix real data in some of the homepage elements
leonoosterhuis Jan 22, 2024
a783ae3
Compile and minify production files
invalid-email-address Jan 22, 2024
bbb4a02
ID-39 Small extra fix
leonoosterhuis Jan 22, 2024
e1743c9
Merge remote-tracking branch 'origin/ID-39-As-a-stakeholder-I-want-to…
leonoosterhuis Jan 22, 2024
b7097a9
Compile and minify production files
invalid-email-address Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions app/Domain/Trip/Jobs/PostTripJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@ class PostTripJob implements ShouldQueue
use SerializesModels;


public function handle(Trip $trip)
public Trip $trip;
public function __construct(Trip $trip)
{
$this->processTrip($trip);
$this->trip = $trip;
}


$this->processProfiles($trip);
public function handle()
{
$this->processTrip($this->trip);

$this->processEvents($trip);
$this->processProfiles($this->trip);

$this->processEvents($this->trip);
}

private function processTrip(Trip $trip): void
Expand All @@ -33,7 +40,6 @@ private function processTrip(Trip $trip): void
$avrageSpeed = $this->getAverageSpeed($trip);

$distance = $duration * $avrageSpeed / 3600;

$trip->update([
'distance' => $distance
]);
Expand Down
46 changes: 42 additions & 4 deletions app/UserInterface/Domain/Homepage/Controllers/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

namespace App\UserInterface\Domain\Homepage\Controllers;

use App\Domain\Device\Model\Device;
use App\Domain\Shared\Interface\BreadCrumbInterface;
use App\Domain\Shared\ValueObject\BreadCrumbValueObject;
use App\Domain\Shared\ValueObject\RouteValueObject;
use App\Domain\Trip\Jobs\PostTripJob;
use App\Domain\Trip\Model\Trip;
use App\Domain\Trip\Model\TripEvent;
use App\Helpers\View\Abstract\AbstractViewController;
use App\Helpers\View\ValueObject\ButtonValueObject;
use App\Helpers\View\ValueObject\PageHeaderValueOject;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class Main extends AbstractViewController implements BreadCrumbInterface
{
Expand All @@ -34,10 +39,7 @@ protected function pageHeader(): PageHeaderValueOject
/**
* @inheritdoc
*/
protected function appendViewData(Request $request): array
{
return [];
}


public function getBreadCrumb(Request $request): BreadCrumbValueObject
{
Expand All @@ -46,4 +48,40 @@ public function getBreadCrumb(Request $request): BreadCrumbValueObject
route: new RouteValueObject('homepage')
);
}

public function get_stats()
{

$data['weekly'] = $this->get_weekly_review();

return response()->json(['stats' => $data]);
}

public function get_weekly_review()
{
$allSpeeds = [];
$trip = Trip::whereUserId(Auth::id())->get();
foreach ($trip as $t) {
$allSpeeds[] = $t->data()->get()->avg('speed');
}
$sumspeed = array_sum($allSpeeds);
if (count($allSpeeds) == 0) {
$data['avg_speed'] = "N/A";
return $data;
}
$avgspeed = $sumspeed / count($allSpeeds);
$rounded = round($avgspeed);
$data['avg_speed'] = $rounded;
return $data;
}

public function get_recent_trips()
{
}

protected function appendViewData(Request $request): array
{
$data['device'] = Device::whereUserId(Auth::id())->orderBy('created_at', 'desc')->first();
return $data;
}
}

This file was deleted.

This file was deleted.

31 changes: 28 additions & 3 deletions app/UserInterface/Domain/Homepage/Resources/sass/_homepage.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.homepage-under-construction {
margin-top: 7.5rem;
margin-top: 0.25rem;
display: flex;
justify-content: center;
flex-direction: column;
Expand All @@ -18,6 +18,31 @@
}

img {
width: 400px;
width: 25rem;
}
}


.recent {
height: 5rem;
border-radius: 0.625rem;
background-color: #ffffff;
padding: 0.9375rem;
color: #000000;
display: flex;
cursor: pointer;
margin-bottom: 1rem;
box-shadow: rgba(149, 157, 165, 0.2) 0px 2px 2.5px;
}

.review {
height: 11rem;
border-radius: 0.625rem;
background-color: #ffffff;
padding: 0.9375rem;
color: #000000;
display: flex;
cursor: pointer;
margin-bottom: 1rem;
box-shadow: rgba(149, 157, 165, 0.2) 0px 2px 2.5px;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#recent-device-wrapper {
padding: 1rem 2rem;
min-width: 100%;
justify-content: center;
align-items: center;
border-radius: 0.625rem;
background-color: #ffffff;
color: #000000;
cursor: pointer;
margin-bottom: 1rem;
box-shadow: rgba(149, 157, 165, 0.2) 0px 2px 2.5px;



#recent-device-header {
width: 100%;

.card {
padding: 2rem 2rem 2rem 2rem;
}

.icon {
display: flex;
justify-content: center;
align-items: center;
background-color: var(--color-gray-100);
border-radius: 10%;
padding: 1rem;

i {
font-size: 3rem;
padding: 0.5rem 0.5rem;
color: var(--color-tertiary-color);
}
}

.details {
padding: 0 0.9rem;

.name {
margin-top: 1rem;
margin-left: 0.5rem;

h3 {
font-size: 2rem;
font-weight: 600;
margin: 0;
}

p {
font-size: 1rem;
margin: 0;
color: var(--color-gray-500);
}
}

.badges {
margin-top: 0.5rem;

.badge {
border: 1px dashed var(--color-gray-300);
padding: 0.5rem 1rem;
border-radius: .475rem !important;
min-width: 125px;
margin: 0.5rem 0;
color: black;
text-align: left;
font-size: 1rem;

.badge-value {
i {
margin-right: 0.5rem;
}

font-size: 1.25rem;
}

.badge-label {
font-weight: 200;
margin: 0;
margin-top: 0.3rem;
color: var(--color-gray-500);
}
}
}
}
}
}
98 changes: 98 additions & 0 deletions app/UserInterface/Domain/Homepage/Resources/sass/_recent_trip.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#recent_trip_wrapper {
.page-item {
&:not(#datatable_previous, #datatable_next) {
a {
background-color: var(--color-secondary-color);
border-color: var(--color-secondary-color);

&:hover {
background-color: var(--color-secondary-color-hover);
border-color: var(--color-secondary-color-hover);
}
}
}

}
}

.dt-recent-trip-wrapper {
display: inline-block;
background-color: var(--color-tertiary-color);
color: white;
border-radius: 50%;
padding: 0.5em;
font-size: 1.25em;
font-weight: bold;
width: 2.8em;
height: 2.8em;

.number {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 0.75em;
}
}

.r-type-inline-d {
font-size: 1.5rem;
}

.r-type-inline-l {
color: grey;
text-overflow: ellipsis;
}

.trip-review-container {
max-height: 125px;
height: 125px;
display: flex;
justify-content: space-evenly;
padding-left: 1rem;
flex-direction: column;

.trip-review {
display: flex;
align-items: center;
margin-top: 0.25rem;

&-title-wrapper {
display: flex;
justify-content: center;
width: 100%;
flex-direction: column;


.trip-review-title {
font-size: 1.25rem;
font-weight: 500;
}

.trip-review-unit {
font-size: 0.75rem;
font-weight: 400;
color: var(--color-gray-500);
}
}

&-value-wrapper {
width: 70px;
height: 35px;
margin-right: 1rem;
display: flex;
justify-content: center;
align-items: center;
background-color: var(--color-tertiary-color);
border-radius: 0.25rem;


.trip-review-value {
margin-top: 3px;
font-size: 1.25rem;
font-weight: 700;
color: white;
}
}
}
}
Loading