From bf323baa88275cd50a2ad5e7d62afb955a51bd62 Mon Sep 17 00:00:00 2001 From: Saluki Date: Sun, 7 Jun 2015 01:29:39 +0200 Subject: [PATCH] Finishing the cash component new UI (adding informations, exact formats, ...) --- app/Http/Controllers/CashController.php | 2 +- app/Models/SnapshotDetails.php | 2 +- .../SnapshotDetailsRepository.php | 1 + resources/views/cash/app.blade.php | 42 +++++++++++++------ 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/CashController.php b/app/Http/Controllers/CashController.php index 3acf9f7..8684f18 100644 --- a/app/Http/Controllers/CashController.php +++ b/app/Http/Controllers/CashController.php @@ -43,7 +43,7 @@ public function dashboard($requestedSnapshot=null) } } - $snapshotDetails = $this->detailsRepository->fromSnapshot($snapshot->cs_id); + $snapshotDetails = $this->detailsRepository->fromSnapshot($snapshot->cs_id); $allSnapshots = $this->repository->all(); $cashArray = [ floatval($snapshot->amount) ]; diff --git a/app/Models/SnapshotDetails.php b/app/Models/SnapshotDetails.php index 31617af..5bb3c95 100644 --- a/app/Models/SnapshotDetails.php +++ b/app/Models/SnapshotDetails.php @@ -11,7 +11,7 @@ class SnapshotDetails extends Model { public function scopeGroup($query, $groupID) { $query->join('cash_snapshots', 'cash_snapshots.cs_id', '=', 'snapshot_details.cs_id') - ->where('group_id', $groupID); + ->where('cash_snapshots.group_id', $groupID); } } \ No newline at end of file diff --git a/app/Repositories/SnapshotDetailsRepository.php b/app/Repositories/SnapshotDetailsRepository.php index 21521e1..a198f6b 100644 --- a/app/Repositories/SnapshotDetailsRepository.php +++ b/app/Repositories/SnapshotDetailsRepository.php @@ -19,6 +19,7 @@ public function fromSnapshot($id) try { return $this->model->group( Session::get('groupID') ) + ->leftJoin('users', 'snapshot_details.user_id', '=', 'users.user_id') ->where('snapshot_details.cs_id', '=', $id) ->get(); } diff --git a/resources/views/cash/app.blade.php b/resources/views/cash/app.blade.php index dde40d2..098de24 100644 --- a/resources/views/cash/app.blade.php +++ b/resources/views/cash/app.blade.php @@ -42,7 +42,9 @@
-

{{ $snapshot->snapshot_title }} #{{ $snapshot->cs_id }}

+

+ {{ $snapshot->snapshot_title }} #{{ $snapshot->cs_id }} +

@@ -58,11 +60,19 @@
@@ -88,20 +98,20 @@
Last Cash Operation
@if( $lastOperation>0 ) - +{{ $lastOperation }}€ + +{{ number_format($lastOperation,2) }}€ @else - {{ $lastOperation }}€ + {{ number_format($lastOperation,2) }}€ @endif
Cash In Drawer
-
{{ end($amounts) }}€
+
{{ number_format(end($amounts),2) }}€
Cash By Sales
-
+{{ $cashBySales }}€
+
+{{ number_format($cashBySales,2) }}€
@@ -116,7 +126,15 @@
@if( count($details)==0 ) -

This snapshot has no cash operations or sales.

+ +
+
+ +
+ This snapshot has no cash operations or sales. +
+
+ @else
@@ -156,7 +174,7 @@ @endif">{{ $detail->type }}
{{ $detail->sum }}€ {{ date('j F Y G:i', strtotime($detail->time)) }} - #{{ $detail->user_id }} + {{ $detail->firstname }} {{ $detail->lastname }} {{ str_limit($detail->comment,20) }} @endforeach