diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 9fa67a5..3e3a1f6 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -32,7 +32,13 @@ class HomeController extends Controller setlocale(LC_TIME, 'fr_FR.utf8'); $today = new DateTime(); $user_id = Auth::user()->getAuthIdentifier(); - $posts = Post::where('user_id', $user_id)->orderBy('date_post', 'DESC')->get(); + $all_counts = Post::where('user_id', $user_id)->count(); + $year_counts = Post::where('user_id', $user_id)->count(); + $month_counts = Post::where('user_id', $user_id) + ->whereYear('date_post', $today->format('Y')) + ->whereMonth('date_post', $today->format('m'))->count(); + $image_counts = 0; // TODO #4 + $posts = Post::where('user_id', $user_id)->orderBy('date_post', 'DESC')->limit(9)->get(); $today_post = Post::whereDate('date_post', '=', $today->format('Y-m-d')) ->where('user_id', $user_id) ->count(); @@ -44,6 +50,10 @@ class HomeController extends Controller return view('home', [ 'already' => $already, + 'all_counts' => $all_counts, + 'year_counts' => $year_counts, + 'month_counts' => $month_counts, + 'image_counts' => $image_counts, 'today' => $today, 'posts' => $posts, ]); diff --git a/package.json b/package.json index 6ca3519..b5e53e4 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "vue-template-compiler": "^2.6.10" }, "dependencies": { + "tabler-ui": "^0.0.34", "textarea-caret": "^3.1.0" } } diff --git a/resources/js/app.js b/resources/js/app.js index 1307ac6..d454660 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -6,6 +6,8 @@ require('./bootstrap'); +require('tabler-ui/src/assets/scss/bundle.scss'); + window.Vue = require('vue'); /** @@ -30,6 +32,17 @@ window.Vue = require('vue'); import App from './components/App.vue'; Vue.config.productionTip = false; +/** Function for collapse card */ +document.querySelectorAll('[data-toggle="card-collapse"]').forEach(function(card){ + card.addEventListener('click', function(evt) { + let $card = this.parentElement.parentElement.parentElement; + + $card.classList.toggle('card-collapsed'); + evt.preventDefault(); + return false; + }); +}); + const app = new Vue({ render: h => h(App), }).$mount('#app'); diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index e4bc198..80aca1f 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -4,50 +4,125 @@ @section('content')
-
-
-
-
{{ __('Dashboard') }}
- -
- @if (session('status')) - - @endif - -

{{ strftime('%B %G', $today->format('U')) }}

- @if($already) - - @else -
- @csrf -
-
- -
-
-
- {{ $errors->first('message') }} -
-
-
-
- -
-
-
-
- @endif - @foreach($posts as $post) -
-

{{ \Carbon\Carbon::instance($post->date_post)->diffForHumans() }}

-

{!! $tag_detector->linkTagFrom($post->content) !!}

-
- @endforeach + +
+
+
+
+ + + +
+

{{ $all_counts }}

+ {{ __('Jours Écrits') }} +
+
+
+
+ + + +
+

{{ $year_counts }}

+ {{ __('Cette Année') }} +
+
+
+
+
+
+
+ + + +
+

{{ $month_counts }}

+ {{ __('Ce Mois') }} +
+
+
+
+
+
+
+ + + +
+

{{ $image_counts }}

+ {{ __('Images Envoyées') }} +
+
+
+
+
+ @if($already) +
L'activité du jour a déjà été entrée.
+ @else +
+
+
+
+

{{ strftime('%B %G', $today->format('U')) }}

+
+
+
+ @csrf +
+
+ +
+
+
+ {{ $errors->first('message') }} +
+
+
+
+ +
+
+
+
+
+
+
+
+ @endif +
+ @foreach($posts as $post) +
+
+
+
+

{{ ucfirst(\Carbon\Carbon::instance($post->date_post)->diffForHumans()) }}

+
+ + +
+
+
+ {!! $tag_detector->linkTagFrom($post->content) !!} +
+ +
+
+ @endforeach +
@endsection diff --git a/resources/views/layouts/connected.blade.php b/resources/views/layouts/connected.blade.php index c100fe8..4c8badf 100644 --- a/resources/views/layouts/connected.blade.php +++ b/resources/views/layouts/connected.blade.php @@ -2,79 +2,145 @@ - - + + + - {{ config('app.name', 'Laravel') }} + {{ config('app.name', 'Journal Intime') }} - - - - -
- +
+
+
+ +
+
-
+
@yield('content')
+